On Sat, 29 Jun 2002, Mark Carroll wrote: > On Sat, 29 Jun 2002, Shlomi Fish wrote: > (snip) > > counter n = (n,(counter (n+1))) > (snip) > > This doesn't work because you seem to be defining an infinitely deep tuple > (1,(2,(3,(4,(....))))) which is naughty. > > I'm not really sure what alternative to suggest beyond [n .. ] without > knowing more about what you are trying to do. >
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. Regards, Shlomi Fish > -- Mark > > _______________________________________________ > Haskell-Cafe mailing list > [EMAIL PROTECTED] > http://www.haskell.org/mailman/listinfo/haskell-cafe > ---------------------------------------------------------------------- Shlomi Fish [EMAIL PROTECTED] Home Page: http://t2.technion.ac.il/~shlomif/ Home E-mail: [EMAIL PROTECTED] He who re-invents the wheel, understands much better how a wheel works. _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe