[mercury-users] Partial evaluation of closures

Ralph Becket rbeck at microsoft.com
Fri Mar 17 00:55:32 AEDT 2000

Say I write

foo(X) = ( func(Y) = bar(X) + Y )

will the compiler transform this into (what one would expect from)

foo(X) = ( func(Y) = Z + Y ) :-
	Z = bar(X).

or not?  I presume the transformation, if applied, wouldn't go the
other way around.

I appreciate that when writing in a lazy style one would certainly
not want this transformation, but where it can be (easily) proved
that bar(X) will not lead to a recursive call to foo/1, I would
definitely appreciate the optimisation.


Ralph Becket      |      MSR Cambridge      |      rbeck at microsoft.com 
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