Hi, though I think there was written enough about this theme, I can't still understand the following problem (foldl' from the Prelude.hs): > seq1 x = (3-x):seq1 x > seq2 x = (3-x):seq2 1 > > countOne xs = foldl' (\c x -> if x==1 then c+1 else c) 0 xs > > num1 n = countOne (take n (seq1 1)) > num2 n = countOne (take n (seq2 1)) num1 needs lots of heap space, num2 needs very few. Why? (I checked it using ghc and '+RTS -s') Martin Stein
- Re: heap exhausted Martin Stein
- Re: heap exhausted Fergus Henderson
- RE: heap exhausted Sigbjorn Finne
- Re: heap exhausted Malcolm Wallace
- Re: heap exhausted Simon Marlow