;遞歸 (defun my-fib (x) (cond ((= x 0) 0) ((= x 1) 1) (t (+ (my-fib (- x 1)) (my-fib (- x 2)))))) (defun my-fib-iter (a b count) ;(format t "a:~a and b:~a and count:~a ~%" a b count) (cond ((= count 0) b) ((= count 1) a) (t (my-fib-iter (+ a b) a (decf count))))) ;線性迭代 (defun my-fib-1 (n) (my-fib-iter 1 0 n))