Liste des Groupes | Revenir à cl lisp |
After a bit of effort, my first working lisp code which is slightly more
complex than printing "hello", it returns the nth fibonacci number.
How would you lisp gurus have written the code in the proper lisp way.
(defun fib (n)
(let ( (f0 0) (f1 1) (counter 1) )
(loop
(if (>= counter n) (return-from fib f1) )
(let* ( (tmp f0) )
(setf f0 f1) (setf f1 (+ f1 tmp)) (incf counter)))))
Date | Sujet | # | Auteur | |
28 Aug 24 | Re: beggining lisp | 1 | B. Pym |
Les messages affichés proviennent d'usenet.