-
-
Save rootmos/398b1bfac72d1db21e129a4f9f328925 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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