[Haskell-cafe] A guess on stack-overflows - thunks build-up and
tail recursion
Ketil Malde
ketil at malde.org
Fri Mar 20 08:43:47 EDT 2009
Günther Schmidt <gue.schmidt at web.de> writes:
> Apparently it is the evaluation of this huge build-up that causes the
> stack-overflow but not the thunk-build-up *as such*.
> Do I understand this correctly?
I think that is correct.
Prelude> foldl (+) 0 [1..1000000]
*** Exception: stack overflow
Prelude> foldl const 0 [1..1000000]
0
Prelude> foldl (flip const) 0 [1..1000000]
1000000
-k
--
If I haven't seen further, it is by standing in the footprints of giants
More information about the Haskell-Cafe
mailing list