Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,10 @@
let fib n =
let rec real = function
0 -> 1
| 1 -> 1
| n -> real (n-1) + real (n-2)
in
if n < 0 then
None
else
Some (real n)

View file

@ -0,0 +1,7 @@
let rec fix f x = f (fix f) x
let fib n =
if n < 0 then
None
else
Some (fix (fun f -> fun n -> if n <= 1 then 1 else f (n-1) + f (n-2)) n)