Skip to content

Instantly share code, notes, and snippets.

@kunishi
Created July 2, 2012 04:05
Show Gist options
  • Save kunishi/3031016 to your computer and use it in GitHub Desktop.
Save kunishi/3031016 to your computer and use it in GitHub Desktop.
Fibonacci
fun fib n =
let
fun fib1 1 = (1, 0)
| fib1 n =
let
val (l, m) = fib1 (n-1)
in
(l + m, l)
end
in
#1 (fib1 n)
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment