Skip to content

Instantly share code, notes, and snippets.

@athos
Last active December 21, 2015 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save athos/6295370 to your computer and use it in GitHub Desktop.
Save athos/6295370 to your computer and use it in GitHub Desktop.
let fib n =
(let rec iter n a b =
(if ((=) n 0)
then a
else (iter ((-) n 1) b ((+) a b)))
in (iter n 0 1))
(define (fib n)
(define (iter n a b)
(if (= n 0)
a
(iter (- n 1) b (+ a b))))
(iter n 0 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment