News for hackers. Stuff that matters.
Re:Tail Recursion by sdevlin on Tuesday November 27, 2012 @12:22PM (#4837710)
Decent explanation, but I have a couple quibbles.

First, the term "tail recursion" is overly narrow. This transformation should apply to all tail calls, not just recursive ones. This is useful, for example, in families of mutually recursive functions.

Second, this transformation is not really an optimization, as it changes the behavior of some programs (by preventing stack overflow or memory allocation errors). It's a documented feature of languages (or specific implementations of languages) that users rely on to write programs in a particular style.

I prefer the term "tail call elimination" to describe these transformations.

Re:Tail Recursion by kvb on Tuesday November 27, 2012 @12:50PM (#4837753)
Of course, some languages only support elimination of tail calls when they're recursive. I believe that Scala suffers from this (since the JVM doesn't support tail call elimination).
Re:Tail Recursion by sdevlin on Tuesday November 27, 2012 @12:53PM (#4837776)
Good point, I'm not very familiar with Scala. I think Clojure may also have this limitation.