Re: global variable
Chris Johansen <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.hugs.user |
|---|---|
| Organization | Eric Conspiracy Secret Labs -&- TechNoMagic; original material copyright 2003 Christopher Karl Johansen |
| Message-ID | <oprxg5pap46c4kbe@localhost> |
On Sun, 12 Oct 2003 19:32:14 +0100, Glynn Clements <[email protected]> wrote: > 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}