
18 Mar
2009
18 Mar
'09
7:19 a.m.
Bas van Dijk
On Sun, Mar 15, 2009 at 7:35 PM, Will Ness
wrote: which is then just rewritable as:
myCycle xs = ys where ys = foldr (:) ys xs
or (arriving at the same result)
myCycle xs = foldr (:) (myCycle xs) xs
Note that, because 'ys' only has to be calculated once, GHC makes the most efficient code for the former one. In the latter 'myCycle xs' has to be calculated each time 'xs' runs empty.
Actually my point was, that " I find that "where" rewrites are easier to comprehend for me, more often than not. :) " " myCycle xs = ys where ys = foldr (:) ys xs " which should be exactly as the one with the let.