Skip to content

Instantly share code, notes, and snippets.

@emanon-was
Last active November 29, 2017 00:51
Show Gist options
  • Save emanon-was/4ebf5b23ff11e545460f5eb4a0d8a839 to your computer and use it in GitHub Desktop.
Save emanon-was/4ebf5b23ff11e545460f5eb4a0d8a839 to your computer and use it in GitHub Desktop.
fibonacci :: (Num a) => [a]
fibonacci = f 0 1
where f x y = x : f y (x + y)
-- Prelude> fibonacci !! 45
-- 1134903170
-- (0.00 secs, 3131752 bytes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment