4 ms·
It appears that your claim "Scala or Clojure that don't have real tail recursion because of the JVM" is in error. http://stackoverflow.com/questions/1677419/do
by gengstrand 10y ago
It appears that your claim "Scala or Clojure that don't have real tail recursion because of the JVM" is in error.
http://stackoverflow.com/questions/1677419/does-scala-support-tail-recursion-optimization http://stackoverflow.com/questions/1677419/does-scala-suppor...
http://clojure.org/reference/special_forms#recur http://clojure.org/reference/special_forms#recur
- tel 10y agoIt's not exactly an error. Neither language offers enough tail recursion to handle complex cases though they both offer simple support.
- bad_user 10y agoI specifically mentioned mutually tail recursive functions. Self-recursive functions, like what you're describing, are much less useful or interesting. I say that as a Scala developer that loves Scala and the JVM - the lack of tail calls optimization at the JVM level is a pain in the ass, because in order to work around it you have to effectively build your own call stack.
- lmm 10y agoAs your own link makes clear, Scala does not have real tail recursion because of the JVM. It has a very limited form of tail recursion.