Skip to content

Instantly share code, notes, and snippets.

@hauleth
Created May 21, 2011 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hauleth/984986 to your computer and use it in GitHub Desktop.
Save hauleth/984986 to your computer and use it in GitHub Desktop.
-- Copyright (c) 2011 by Łukasz Niemier <lukasz@niemier.pl>
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