[Hugs-users] stack overflow in tail recursive function
Bruno Schneider
boschneider at gmail.com
Wed Mar 24 08:56:32 EDT 2010
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/
More information about the Hugs-Users
mailing list