[net.lang] recursion buke

mac (03/25/83)

More pitches for recursion:

One of the reasons recursion has a bad name is that the conventional
implementation is bad.  Even iterative forms of recursion in PASCAL, etc.
cause the stack to grow with saved activations that will never be re-used.
Those who think of recursion as inefficient probably have a fixed idea of
what a procedure call is.  This is the old argument that LISP is hard for
FORTRAN (and PASCAL, and C, ...) programmers to learn.

Another way to implement function calls is to separate the state saving
(which is only sometimes necessary) from the control transfer.  This allows
one to optimize "tail-recursion" -- not saving the state when the last thing
a procedure does is call another.  Several LISP interpreters do this.  It's
significant in such languages, where almost everything is a call,

Unfortunately, we are nowadays designing hardware with the usual kind of
call wired into it, so there's little hope that e.g.  PASCAL will ever do
this.

As far as interpreters vs. compilers: why not have both?  LISP has
interpreters to make development easier, and compilers to make production
faster.

(I'm not really an incurable LISPer. I've just come to appreciate its
many (obscure) virtues, as well as its (obvious) defects.)

	Alex Colvin