/ob-kotlin

org-babel functions for kotlin evaluation

Primary LanguageEmacs Lisp

ob-kotlin

org-babel functions for kotlin evaluation

options

optionexample
:session:session mysession

examples

#+BEGIN_SRC kotlin
1..100 filter {it % 19 == 0} reduce {a,b -> a + b}
#+END_SRC

#+RESULTS:
: 285
#+BEGIN_SRC kotlin
fun fib(n: Int):Int {
    return when (n) {
           0,1 -> 1
           else -> fib(n - 1) + fib(n - 2)
    }
}

fib(19)
#+END_SRC

#+RESULTS:
: 6765

workaround for data class in kotlin repl(adding the square brackets)

#+BEGIN_SRC kotlin
[data] class User(val id:String, val name:String)

User("19", "kotlin")
#+END_SRC

#+RESULTS:
: User(id=19, name=kotlin)