[Haskell-cafe] About Fibonacci again...
Bernie Pope
bjpop at csse.unimelb.edu.au
Thu Nov 8 00:47:10 EST 2007
On 08/11/2007, at 10:56 AM, jerzy.karczmarczuk at info.unicaen.fr wrote:
>
> rs 0 = [0]
> rs 1 = [1]
> rs n = rs (n-1) ++ rs (n-2)
>
>
> Would somebody try to solve it, before I unveil the solution? It isn't
> difficult.
>
> Jerzy Karczmarczuk
Is this what you are looking for:
mrs = [0] : [1] : zipWith (++) (tail mrs) mrs
then you can get the one you want with:
mrs !! index
given a suitable value for index
Cheers,
Bernie.
More information about the Haskell-Cafe
mailing list