Advertisement
konalisp

sig.fs

Sep 26th, 2015
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.31 KB | None | 0 0
  1. open System
  2.  
  3. module MyMod1 =
  4.  
  5.     type Fib = bigint -> bigint //function signatures!
  6.     let fib:Fib = fun n ->
  7.         let rec loop acc1 acc2 = function
  8.             | n when n = 0I -> acc1
  9.             | n -> loop acc2 (acc1 + acc2) (n - 1I)
  10.         loop 0I 1I n
  11.      
  12.  
  13. Console.WriteLine(MyMod1.fib 6I)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement