Skip to content

Instantly share code, notes, and snippets.

@23Skidoo
Created June 23, 2011 18:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 23Skidoo/1043189 to your computer and use it in GitHub Desktop.
Save 23Skidoo/1043189 to your computer and use it in GitHub Desktop.
Fibonacci
{-# LANGUAGE BangPatterns #-}
module Main where
zipWith' :: (t -> t1 -> a) -> [t] -> [t1] -> [a]
zipWith' f (!x:xs) (!y:ys) = f x y : zipWith' f xs ys
zipWith' _ _ _ = []
fibs :: [Integer]
fibs = 0 : 1 : zipWith' (+) fibs (tail fibs)
main :: IO ()
main = print . head . drop (10^6) $ fibs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment