[Haskell-cafe] About Fibonacci again...

Ross Paterson ross at soi.city.ac.uk
Thu Nov 8 07:53:34 EST 2007


On Thu, Nov 08, 2007 at 12:09:27PM +0100, jerzy.karczmarczuk at info.unicaen.fr wrote:
> This was my solution: 
> rs_jk = 1:rq where _:rq = concat (map (\x->1:[0|x==1]) rs_jk) 
> This is a bit similar to RP.

I started with that, but eliminated the tail by substituting and unrolling:

_:rq = concat (map (\x->1:[0|x==1]) rs_jk)
     = concat (map (\x->1:[0|x==1]) (1:rq))
     = 1:0:concat (map (\x->1:[0|x==1]) rq)


More information about the Haskell-Cafe mailing list