Paul Moore <[EMAIL PROTECTED]> wrote:

> Now, I tried this in Hugs98 and found inconclusive results. Both fact1
10000
> and fact2 10000 failed with a control stack overflow. However, when I was
> experimenting earlier today (I didn't save the results :-() I got a
> variation on fact2 which went well beyond 10000, although it failed
further
> on with a garbage collection not being able to reclaim enough space (which
> indicates that Hugs may *still* not be fully optimising to an iterative
form
> - unless the numbers had got so huge that the space for the bignums
involved
> was filling my RAM - but that seems unlikely...)

I think Haskell's lazy evaluation is invalidating your tests. The gc problem
is probably caused by memory being filled up with partially-evaluated (or
not yet evaluated) expressions.

I'm not sure offhand whether Haskell guarantees tail-recursion
optimizations, but I'm sure there are several people on this list who can
tell us...

Craig




Reply via email to