Created
May 21, 2011 23:10
-
-
Save hauleth/984986 to your computer and use it in GitHub Desktop.
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
-- Copyright (c) 2011 by Łukasz Niemier <[email protected]> | |
import System( getArgs ) | |
fibonacci = 0 : 1 : (zipWith (+) fibonacci $ tail fibonacci) | |
printFib x = if x < 0 then error "Index must be greater or equal 0" else print $ fibonacci !! x | |
main = do | |
args <- getArgs | |
mapM printFib $ map (\x -> read x::Int) args |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment