What limitations does the JVM impose on tail-call optimization
Clojure does not perform tail call optimization on its own: when you have a tail recursive function and you want to have it optimized, you have to use the special form recur
. Similarly, if you have two mutually recursive functions, you can optimize them only by using trampoline
.
Y combinator and tail call optimizations
The definition of a Y combinator in F# is
Tail-recursive implementation of take-while
I am trying to write a tail-recursive implementation of the function take-while
in Scheme (but this exercise can be done in another language as well). My first attempt was
Tail-recursive implementation of take-while
I am trying to write a tail-recursive implementation of the function take-while
in Scheme (but this exercise can be done in another language as well). My first attempt was