[m-rev.] for review: lco and constant constructions

Zoltan Somogyi zs at unimelb.edu.au
Fri Jul 20 16:48:05 AEST 2012


On 20-Jul-2012, Peter Wang <novalazy at gmail.com> wrote:
> > 	V1 = a,
> > 	V2 = b,
> > 	V3 = f(a, b),
> > 	Headvar4 = g(V3, X)
> > 
> > You code would allow V1 and V2, but not V3.
> 
> An existing ConsTag test allows it.

But it wouldn't allow e.g. V6 = no_tag(V5).

You need two different tests for two different kinds of unifications.
For those that depend directly or indirectly on a value generated by the
recursive call, you need to test the tag. For those that don't, you
don't care what the tag is. You may not even require it to be a unify goal;
there is no reason why you shouldn't allow a from_ground_term_construct
goal in that role as well, or even an arbitrary det goal that (a) does not
depend on the output of the recursive call, and (b) is guaranteed to neither
throw an exception nor loop forever. The point is, goals of the second kind
need no processing beyond being moved before the recursive call.

Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list