[mercury-users] Tail call optimisation in hlc grades

Michael Day mikeday at yeslogic.com
Mon Aug 20 18:33:08 AEST 2007

Hi Julien,

> I don't think so, you still don't get tail recursion for insert_items/4
> even if you make the modes `in' and `out'.  I think it's more likely
> the type that may be causing the problem here (in fact if you change the
> arguments to make what was the array, polymorphic you do get tail
> recursion.)  I'll keep looking into this one.

It would be good to figure out what's going on, as it seems like it 
would affect any seemingly tail recursive predicate using arrays.

I eventually made an impure predicate that only passed the array in and 
destructively modified it, rather than threading the array argument 
through. This variant was correctly compiled with the tail call 
optimised into a loop.



Print XML with Prince!
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au

More information about the users mailing list