Re: Iteration in lisp
- From: Pascal Costanza <pc@xxxxxxxxx>
- Date: Tue, 22 Apr 2008 11:55:38 +0200
Pertti Kellomäki wrote:
Kent M Pitman wrote:wrf3@xxxxxxxxxxxxxxx (Bob Felts) writes:Kent M Pitman <pitman@xxxxxxxxxxx> wrote:AAny pointers to the rationale for this decision?
recursive function can run out of stack since CL does not guarantee
tail call elimination.
Stack debugging.
While technically correct, I don't think this really holds
water. In the absence of guaranteed tail call elimination,
iterative processes have to be written using loops, which
destroy exactly the same information as tail calls.
No, they don't have to be written using loops.
You could, for example, decide to use a recursive version _in order_ to have more debug information at runtime.
There are some programming techniques that are only possible with
tail call elimination, yet have little to do with functional
programming. Implementing a state machine as a set of mutually
recursive functions comes to mind, and I'm sure there are others
as well.
It would be good if the decision whether you want more debug information or not were orthogonal to whether you use recursion or iteration. The latter should ideally depend on whatever makes the code easier to understand. More often than not, iteration constructs reveal the intent of the programmer more clearly, though, because they are typically more specialized.
Pascal
--
1st European Lisp Symposium (ELS'08)
http://prog.vub.ac.be/~pcostanza/els08/
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
.
- Follow-Ups:
- Re: Iteration in lisp
- From: Robert Maas, http://tinyurl.com/uh3t
- Re: Iteration in lisp
- From: Pertti Kellomäki
- Re: Iteration in lisp
- References:
- Iteration in lisp
- From: rigaha@xxxxxxxxx
- Re: Iteration in lisp
- From: Kent M Pitman
- Re: Iteration in lisp
- From: Bob Felts
- Re: Iteration in lisp
- From: Kent M Pitman
- Re: Iteration in lisp
- From: Pertti Kellomäki
- 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
|
Loading