9 lines
163 B
Common Lisp
9 lines
163 B
Common Lisp
|
|
(defun fib (n)
|
||
|
|
(assert (>= n 0) nil "'~a' is a negative number" n)
|
||
|
|
(funcall
|
||
|
|
(alambda (n)
|
||
|
|
(if (>= 1 n)
|
||
|
|
n
|
||
|
|
(+ (self (- n 1)) (self (- n 2)))))
|
||
|
|
n))
|