
29 Jun
2002
29 Jun
'02
11:36 a.m.
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.