[Haskell-cafe] laziness
Taral
taralx at gmail.com
Sun Dec 10 13:18:26 EST 2006
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