[Haskell-cafe] laziness
Ranjan Bagchi
ranjan.bagchi at frotz.com
Sun Dec 10 20:32:46 EST 2006
Thank you -- turns out that mapAccumL did exactly what I wanted it
to, push state through processing a very large list.
Thanks,
Ranjan
On Dec 10, 2006, at 10:18 AM, Taral wrote:
> On 12/9/06, Ranjan Bagchi <ranjan.bagchi at frotz.com> wrote:
>> Which is great.. however, what I'd like to fold the list over a
>> tuple:
>> >foo x (l,payload) = ((x:l), payload)
>> >(x,_) = foldr foo ([], Nothing) [1..]
>> >(take 10) x
>>
>> Doesn't terminate, until the stack overflows
>
> Look at Data.List's mapAccumR function.
>
> --
> Taral <taralx at gmail.com>
> "You can't prove anything."
> -- Gödel's Incompetence Theorem
>
>
More information about the Haskell-Cafe
mailing list