Re: Iteration in lisp
- From: Kaz Kylheku <kkylheku@xxxxxxxxx>
- Date: Tue, 22 Apr 2008 07:48:10 -0700 (PDT)
On Apr 21, 8:45 pm, w...@xxxxxxxxxxxxxxx (Bob Felts) wrote:
Kent M Pitman <pit...@xxxxxxxxxxx> wrote:
"rig...@xxxxxxxxx" <rig...@xxxxxxxxx> writes:
If you want to iterate through a list, should you use a recursive
function or a loop?
In Common Lisp, always prefer a loop where practical unless you know
with relative certainty that the problem cannot grow very big. A
recursive function can run out of stack since CL does not guarantee
tail call elimination.
Any pointers to the rationale for this decision?
This isn't rationale for that decision, but look through January
archives of this newsgroup for the TAILPROG macro, by which I show
that tail recursion is just syntactic sugar for goto, and portable
tail recursion with syntax resembling FLET or LABELS can be obtained
from a fairly simple, small macro.
.
- References:
- Iteration in lisp
- From: rigaha@xxxxxxxxx
- Re: Iteration in lisp
- From: Kent M Pitman
- Re: Iteration in lisp
- From: Bob Felts
- Iteration in lisp
- Prev by Date: Re: Iteration in lisp
- Next by Date: Re: Iteration in lisp
- Previous by thread: Re: Iteration in lisp
- Next by thread: Re: Iteration in lisp
- Index(es):
Relevant Pages
|