[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tail Recursion in Common Lisp ???

I hope this issue has not been rehashed too many times -- I have not
been reading this list for long.

Scheme at MIT left out iterative constructs as a pedagogical
exercise, both to show that it was practical and to force
students (who are usually familiar with iterative constructs)
to think recursively.  Syntactic sugar for iteration (e.g. DO)
appears in the new Scheme standard, and is acknowledged by most
Scheme people to be a useful way of thinking about many problems.

An implementation of Common Lisp that does not do tail recursion is
just a bad implementation.  Specifications of resource optimizations
do not belong in the language spec; it is up to the buyers/users to be
aware of the limitations of an implementation.  Buying a Common Lisp
which lacks tail recursion is like buying a car with a 2-pint gas
tank -- it'll get you moving, but not too far.

There is a legitimate worry here.  If programmers believe (as ZetaLISP
programmers do) that recursion is a bad thing because of resource
constraints, they won't use one of the two most useful styles of
programming in Lisp.  Instead of putting a requirement in the
language, the common wisdom should be that a Common Lisp without tail
recursion (or a compiler, which should go much further in static
analysis of resource usage) is not to be taken seriously.  Then we can
all assume it, much as C programmers assume at least 2K words of
stack.  Otherwise portable code will avoid it, and all Common Lisp
programmers will be the poorer.