On 2003-10-12 at 20:20BST Jose Morais wrote: > Hello, > > I need a function called, say, newItem, that when > first called returns 1, the next time it is called it > would return 2, then 3 and so on. How can I achieve this?
You can't (as Glynn has explained), and most of the time it's the wrong thing to do anyway. Apart from the monadic approach (which is perhaps a bit heavyweight), another way of tackling this sort of thing is to used infinite lists. item_numbers:: [Integer] item_numbers = [1..] You can then operate on those with map and fold. J�n -- J�n Fairbairn [EMAIL PROTECTED] _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
