Skip to content

Instantly share code, notes, and snippets.



Created Sep 28, 2013
What would you like to do?
My first Haskell function, calculates the fibonacci sequence.
-- Takes an empty list *l* and calculates a *n* numbers in the fibonacci sequence
fib l n
| l == [] = fib [1,1] n
| length(l) <= n = fib (sum(take 2 l) : l) n
| otherwise = l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment