Hi Bas,
I'd like to share some thoughts with you.
Let's say I'm unable, for whatever reason, to force full evaluation of
the accumulator during a foldl.
So I have this huge build up of thunks, which causes a stack overflow
when the thunks are being reduced.
I wonder if I could write some
Thanks Bas and Ketil,
the point I wanted to stress though is that the stack overflow does
actually not occur doing the recursive algorithm, just a build-up of thunks.
The algorithm itself will eventually complete without the stack overflow.
The problem occurs when the result value is needed
The problem occurs when the result value is needed and thus the
thunks need to be reduced, starting with the outermost, which can't
be reduced without reducing the next one etc and it's these
reduction steps that are pushed on the stack until its size cause a
stack-overflow.
Yes,
Thanks Bas and Ketil,
the point I wanted to stress though is that the stack overflow does
actually not occur doing the recursive algorithm, just a build-up of thunks.
The algorithm itself will eventually complete without the stack overflow.
The problem occurs when the result value is needed
On Fri, Mar 20, 2009 at 2:01 PM, GüŸnther Schmidt gue.schm...@web.de wrote:
The problem occurs when the result value is needed and thus the thunks need
to be reduced, starting with the outermost, which can't be reduced without
reducing the next one etc and it's these reduction steps that
GüŸnther Schmidt wrote:
the point I wanted to stress though is that the stack overflow does
actually not occur doing the recursive algorithm, just a build-up of thunks.
You can also observe this with suitable trace statements. For example:
import Debug.Trace
import System.Environment
Günther Schmidt wrote:
the point I wanted to stress though is that the stack overflow does
actually not occur doing the recursive algorithm, just a build-up of
thunks.
The algorithm itself will eventually complete without the stack overflow.
The problem occurs when the result value is