[mercury-users] map is not tail-recursive

Julien Fischer juliensf at cs.mu.OZ.AU
Tue Mar 28 12:20:50 AEDT 2006


On Sat, 25 Mar 2006, Michael Day wrote:

> Map is not tail-recursive. This means that applying map to a long list
> will lead to a stack overflow, which sucks.
>
> Is this something that can be fixed, either by an optimisation to
> introduce an accumulator argument or by explicitly writing it like this:

In the case of map, compiling with `--optimize-constructor-last-call',
ought to help.

Julien.

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list