[Haskell-cafe] least fixed points above something

Edsko de Vries devriese at cs.tcd.ie
Thu Mar 19 12:41:53 EDT 2009


On 19 Mar 2009, at 16:37, Martijn van Steenbergen wrote:

> Neil Mitchell wrote:
>> if length (replicate 'a' 10000) == 1 then [] else head (replicate  
>> 'a' 10000)
>> This program will use O(1) memory.
>
> Doesn't length force evaluation of the 10000 cells?

Yes, but without CSE every cell can immediately be garbage collected;  
hence, CSE can lead to space leaks - a fair point.

Edsko


More information about the Haskell-Cafe mailing list