23 Oct
2003
23 Oct
'03
8:10 a.m.
On Sun, 12 Oct 2003 19:32:14 +0100, Glynn Clements
Jose Morais wrote:
I need a function called, say, newItem :: Int, that when first called returns 1, the next time it is called it would return 2, then 3 and so on.
That isn't a function. A function is a mapping from argument values to result values; the result depends solely upon the argument.
Why isn't newItem a function that maps an argument (say lastValue) to the same argument (lastValue) incremented by one? Does Haskell support recursion? Just a learner's ignorant questions. Regards, -- Chris Johansen {johansen at main dot nc dot us}