recursion performance
- From: "zion_zii" <nick.kigs@xxxxxxxxx>
- Date: 29 Nov 2005 14:35:47 -0800
Im just starting to program in lisp so please bear with me. As an
exercise, I was supposed to write the + function for 2
integers(symbols). This is what I wrote
(defun our+ (n m)
(cond
( (zerop m) n)
(t (+ (1+ n) (1- m) ) ) ) )
The suggested answer is as follows.
(defun our-add ( n m)
(cond
( (zerop m) n)
(t (1+ (our-add n (1- m) ) ) ) ) )
My question is this: Is there any difference in performance between the
first and the second?
Granted, I want to follow what the author has deemed accurate but I
dont want to do so blindly. Thanks in advance.
.
- Follow-Ups:
- Re: recursion performance
- From: Stephen Compall
- Re: recursion performance
- From: Ulrich Hobelmann
- Re: recursion performance
- Prev by Date: Re: Match Error on Dialog Box
- Next by Date: Re: OT to the extreme [Was Re: I'm working on yet another license]
- Previous by thread: Re: SeaFunc meets Nov. 29th
- Next by thread: Re: recursion performance
- Index(es):