[Haskell-cafe] Stupid newbie question

Jeremy Shaw jeremy.shaw at linspireinc.com
Fri Jan 5 21:02:29 EST 2007


At Fri, 05 Jan 2007 17:58:14 -0800,
Jeremy Shaw wrote:

> Because you never demand the value of any element in the list, Haskell
> never bothers to calculate it. So you have a list that looks like:
> 
>  [ i,  i - 1, (i - 1) - 1, ((i - 1) - 1 - 1), .. ]

I should clarify that this is the list that will be built by:

> makelist i = i : (makelist (i-1))

[1..] will be building something like:

> [ 1, succ 1, succ (succ 1), succ (succ (succ 1)), ...]

j.


More information about the Haskell-Cafe mailing list