Skip to content

Instantly share code, notes, and snippets.

@cohalz
Created January 20, 2014 10:42
Show Gist options
  • Save cohalz/8518102 to your computer and use it in GitHub Desktop.
Save cohalz/8518102 to your computer and use it in GitHub Desktop.
(*´・_・`*)
let rec repeat f n x =
if n > 0 then repeat f (n -1) (f x) else x
let fib n =
let (fibn, _) = repeat (fun (p, c) -> (c, c+p)) n (0, 1) in
fibn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment