[Haskell-cafe] About Fibonacci again...

Bernie Pope bjpop at csse.unimelb.edu.au
Thu Nov 8 05:18:09 EST 2007


You can make it pretty short too, if you allow yourself fix:

    rs=1:fix(\f p n->n++f(p++n)p)[1][0]

I came up with this on the train home, but then I realised it was the  
same as your solution :)

On 08/11/2007, at 12:57 PM, Alfonso Acosta wrote:

> How about this,
>
> infiniteRS :: [Int]
> infiniteRS = let acum a1 a2 = a2 ++ acum (a1++a2) a1 in 1 : acum  
> [1] [0]
>
> it certainly fits in one line but it's not really elegant
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list