Skip to content

Instantly share code, notes, and snippets.

@jakab922
Created October 6, 2015 20:44
Show Gist options
  • Save jakab922/039990c1e39e2773338c to your computer and use it in GitHub Desktop.
Save jakab922/039990c1e39e2773338c to your computer and use it in GitHub Desktop.
Simple fibonacci generator
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