Created
October 6, 2015 20:44
-
-
Save jakab922/039990c1e39e2773338c to your computer and use it in GitHub Desktop.
Simple fibonacci generator
This file contains hidden or 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
import System.Environment | |
fib_gen = 0 : 1 : [a + b | (a, b) <- zip fib_gen (tail fib_gen)] | |
main = do | |
args <- getArgs | |
let first_arg = if null args then "1" else head args | |
let fa = read first_arg :: Int | |
print $ last $ take fa fib_gen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment