Re: recursion performance
- From: Ulrich Hobelmann <u.hobelmann@xxxxxx>
- Date: Wed, 30 Nov 2005 08:57:43 +0100
Pascal Costanza wrote:
Both versions cheat because even the second version uses the 1+ and 1- functions. It's no wonder that the OP feels confused because the suggested answer is confusing.
Well, I'm assuming that 1+ and 1- are primitives to use. Of course it would be nicer to have something like a zero (or nil) and an add1 function that pushes a value onto the list...
If you don't want to cheat, you can only do this by encoding numbers manually, for example implicitly by the number of atoms in a list, or some such.
But in the end I think it doesn't really matter how the primitives work, as long as you use only them.
Again, this exercise doesn't teach anything about Lisp.
Nothing specific, no. Maybe the OP is just getting a feel for the language.
I don't think posting a (even useless) Lisp program on c.l.l hurts. If anything, it makes more people comfortable with ((syntax)).
-- The road to hell is paved with good intentions. .
- References:
- recursion performance
- From: zion_zii
- Re: recursion performance
- From: Ulrich Hobelmann
- Re: recursion performance
- From: Pascal Costanza
- recursion performance
- Prev by Date: Re: OT to the extreme
- Next by Date: Re: OT to the extreme
- Previous by thread: Re: recursion performance
- Next by thread: Re: recursion performance
- Index(es):
Relevant Pages
|