Subject: Re: New to Common Lisp; range function
From: (Rob Warnock)
Date: Mon, 27 Aug 2007 21:06:20 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Klaus Schilling  <> wrote:
| > There's nothing in the CL stantard per se, but the function you
| > describe would, in CL, commonly be done using LOOP to avoid possible
| > stack overflow for *large* values of (- END START):
| would an iteration with "do" or a tail recursive formulation work?

As others have said, tail recursion [or more generally,
tail call optimization] is not required in Common Lisp,
and is not possible in the general case in the presence of
dynamic variable bindings or exception handler bindings.[1]
Thus, lacking "safe-for-space" tail call optimization,
one can run into the stack overflow issue I mentioned.


[1] Yes, yes, I know there have been some exotic ways
    proposed to handle tail call optimization in the
    presence of dynamic variable bindings, but I don't
    know of any implementation that does so. And even
    then exception handler bindings would mess things up.

Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607