Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let fib n =
- if n = 0 then 0
- else if n = 1 then 1
- else let rec nFibTail (n, prev, curr) =
- if n = 1 then curr else nFibTail(n-1,curr,curr+prev)
- in
- nFibTail(n,0,1);;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement