Skip to content

Instantly share code, notes, and snippets.

@cohalz
Last active January 3, 2016 18:59
Show Gist options
  • Select an option

  • Save cohalz/8506091 to your computer and use it in GitHub Desktop.

Select an option

Save cohalz/8506091 to your computer and use it in GitHub Desktop.
let fib n =
let rec iterfib(i,pre2,pre1,res,n) =
if i >= n then res else iterfib(i+1,pre1,res,res+pre1,n) in
iterfib(1,0,0,1,n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment