Skip to content

Instantly share code, notes, and snippets.

@rootmos

rootmos/fib.hs Secret

Created Jun 6, 2017
Embed
What would you like to do?
module Main where
fib :: Int -> Int
fib 1 = 1
fib 2 = 1
fib n = (fib (n - 1)) + (fib (n - 2))
main :: IO ()
main = putStrLn . show $ fib 45
-- > ghc -O -o fib-hs fib.hs; /usr/bin/time ./fib-hs
-- 5.08user 0.00system 0:05.10elapsed 99%CPU (0avgtext+0avgdata 3276maxresident)k
-- 0inputs+0outputs (0major+168minor)pagefaults 0swaps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment