[plt-scheme] guido on tail recursion

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Sat Apr 25 18:16:21 EDT 2009

Shriram writes:

> It is dangerous to use the term "tail recursion" ever, unless you
> really, really mean recursion in the very narrow sense by which the
> doofus-in-the-street understands it, namely "a function that
> *directly* calls itself".

Or the doofus-in-the-devel-tools, GCC, which will optimize a tail call 
if and only if the return type and space requirements for parameters for 
the called function exactly match those of the current function. Write 
mutually-recursive even? and odd?, stick a gratuitous local variable 
into one, and watch the stack overflow.

Perhaps I shouldn't apply the term "doofus" to GCC, though, as it at 
least tries, unlike CPython. (And the JVM...) --PR

Posted on the users mailing list.