- #!/usr/bin/emacs --script
- (setq fibonacciCalls 0)
- (defun fibonacci (n)
- "generate the nth fibonacci number"
- (setq fibonacciCalls (+ 1 fibonacciCalls))
- (cond
- ((eq n 0) nil)
- ((eq n 1) 0)
- ((eq n 2) 1)
- ((+ (fibonacci (- n 1)) (fibonacci (- n 2)) ))))
- (princ (fibonacci 3))
- (princ fibonacciCalls)
- (print "")
|