than version you've wrote in CL. i would write it like this:
(defun factorial (n)
(loop with p = 1
for i from 1 to n
do (setf p (* p i))
finally (return p)))
IMHO that's cleaner. or if i absolutely must use recursion:
It's shorter when one uses a Lispy language instead of CL.
(define (factorial n)
(do ((i n (- i 1))
(r 1 (* r i)))
((< i 1) r)))
(factorial 5)
===>
120
(factorial -2)
===>
1
--
The good news is, it's not Lisp that sucks, but Common Lisp. --- Paul Graham
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)