On 2003-10-12 at 21:23BST Jose Morais wrote:
> Sorry the newbie question and the insistence, but how exactly do I use
> map or fold applied to the infinite list to get successive integers at
> each time?

You don't. The infinite list /is/ all the successive integers.

I think at this point it would be useful if you could say
what you are trying to do -- what programme are you trying
to write, as opposed to what imperative-sounding programming
technique you are trying to duplicate.

For example, where in an imperative language you might print
the first 10 squares by setting a variable to successive
integers, in Haskell you could write:

positive_naturals = [1..]
squares = map (^2) positive_naturals

main = print $ take 10 squares


which has a similar effect

  J�n

-- 
J�n Fairbairn                                 [EMAIL PROTECTED]


_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to