Tag Archives: fibonacci numbers

(Haskell) Fibonacci List Oneliner

I didn’t invent this, but it’s too cool a snippet not to capture. Here’s a one-liner that will generate a list of Fibonacci numbers in linear time. EXPLANATION: the colon operator is used to add elements to a list, so it starts out adding on the two base cases, zero and one. After you have [...]

Posted in Haskell | Also tagged , , , , | Leave a comment