Re: stack overflow in tail recursive function

Bruno Schneider <[email protected]> Wed, 24 Mar 2010 09:56:32 -0300
Newsgroups gmane.comp.lang.haskell.hugs.user
Message-ID <[email protected]>
On Wed, Mar 24, 2010 at 7:27 AM, Daniel Fischer wrote:
[...]
>
> and this expression is only evaluated if necessary. factorial 20000 builds a thunk of 20000 nested multiplications, this is tried to evaluate when the value is demanded for printing, but the expression is too deeply nested to fit on the stack.
>

So it goes to the stack, hum? It thought it would be just a pointer to
some computation type on the heap.

Anyway, thanks for the detailed answer. I asked here because I didn't
test that code on any other compiler/interpreter, so it could be
something related to hugs implementation.


-- 
Bruno Schneider
http://www.dcc.ufla.br/~bruno/