[ this reply was slightly delayed because I accidentally sent it to just
Fergus instead of the whole list... ]
Fergus Henderson <[EMAIL PROTECTED]> writes:
> The query quoted below, about heap usage in a 5-line Haskell program,
> has remained unanswered for two weeks.
Ok, I'll give it a shot
The query quoted below, about heap usage in a 5-line Haskell program,
has remained unanswered for two weeks.
Can we conclude that reasoning about heap usage in lazy functional languages
is simply too difficult for mere mortals?
If even simple examples like this one are too hard for the experts t
Fergus Henderson notes:
> The query quoted below, about heap usage in a 5-line Haskell program,
> has remained unanswered for two weeks.
Ok, here's an answer. Firstly, foldl' is not in the Standard Prelude,
so I'm assuming the definition is as follows (from hugs 1.3):
foldl' :: Ev
Fergus Henderson [mailto:[EMAIL PROTECTED]] writes:
>
> The query quoted below, about heap usage in a 5-line Haskell program,
> has remained unanswered for two weeks.
>
> Can we conclude that reasoning about heap usage in lazy
> functional languages is simply too difficult for mere mortals?
>
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))
> num