DEV Community

Discussion on: Challenge: Write the recursive Fibonacci algorithm in a different language.

Collapse
yorodm profile image
Yoandy Rodriguez Martinez • Edited on

An Emacs Lisp version. Warning!! This will likely freeze your Emacs!!

(defun fib(n)
         (cond
          ((= n 0) 0)
          ((= n 1) 1)
          (t (+ (fib (- n 1)) (fib (- n 2))))))

UPDATE
Just realized it counts as a Common Lisp version too