Hello!

On Sat, Jun 29, 2002 at 06:23:27PM +0300, Shlomi Fish wrote:
> [...]

> Actually, I'd like a more generalized counter. Something that would return
> both the number and a handler to add another number, which in turn would
> return the new sum and a new handler, etc.

That's just what lazy lists are for. The "handler" thing is done
automatically thanks to lazy evaluation.

I.e. countFrom n = n : countFrom (n + 1)
or just countFrom n = [n..]

Kind regards,

Hannah.
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to