[Haskell-cafe] About Fibonacci again...
Stuart Cook
scook0 at gmail.com
Wed Nov 7 23:24:50 EST 2007
On 11/8/07, jerzy.karczmarczuk at info.unicaen.fr
<jerzy.karczmarczuk at info.unicaen.fr> wrote:
> Would somebody try to solve it, before I unveil the solution? It isn't
> difficult.
*** SPOILER WARNING ***
Here's my attempt, which I wrote without peeking:
let fibs' = 1 : 2 : zipWith (+) fibs' (tail fibs')
rabbits = 1 : 0 : (fibs' >>= flip take rabbits)
It can be golfed down to a single line without difficulty.
Is there a nicer solution?
Stuart
More information about the Haskell-Cafe
mailing list