Hacker News new | ask | show | jobs
by dktbs 4684 days ago
This is great, especially since it removes the TCO limitation from running on the JVM. I will definitely give this a try.
1 comments

I don’t know much Clojure, but I thought that lack of TCO was not a problem because you can just manually add `recur` (http://clojure.org/special_forms#Special%20Forms--%28recur%2...) when you need it. Are there situations where `recur` doesn’t work but tail-call optimization would help?
In my talk I use a finite state machine as an example of something that can really benefit from proper tail calls. In this case, the difference between proper tail calls and loop/recur is the difference between "compiling" the FSM and running the FSM in an interpreter loop.
The quick answer is: mutually recursive functions. True TCO doesn't grow the stack when F calls G calls F again.