[m-rev.] for review: unification expressions

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 22 14:35:05 AEDT 2001


On 21-Nov-2001, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> +++ doc/reference_manual.texi	21 Nov 2001 06:51:00 -0000
> @@ -1067,16 +1067,25 @@
>  @subsection Unification expressions
>  
>  A unification expression is an expression of the form
> +
>  @example
>  X @@ Y
>  @end example
> +
> + at noindent
>  where @var{X} and @var{Y} are data-terms.
>  
>  The semantics of a unification expression is that @var{X} and @var{Y}
>  are unified, and the expression is equivalent to the unified value.
>  
> + at w{@code{Z = X @@ Y}} is equivalent to the conjunction
> + at w{@code{Z = X, Z = Y}}.

As a wording issue, I suggest inserting "A goal of the form "
at the start of that sentence.

But more importantly, this is definition-by-example, which doesn't
really work.  In particular, it doesn't specify the exact semantics of

	p(X @ Y) :- ...

or

	q(...) :- p(X @ Y).

or even

	q(...) :- Z = f(X @ Y).

since none of these have the form `Z = X @ Y'.

>  Unification expressions are most useful when writing switches
> - at pxref{Determinism checking and inference}.
> +(@pxref{Determinism checking and inference}).  The arguments
> +of a unification expression are examined when checking for
> +switches.  The arguments of an equivalent user-defined function
> +would not be.
>  
>  For example
>  
> @@ -1088,8 +1097,10 @@
>  is equivalent to 
>  
>  @example
> -p(X, X) :-
> -        X = f(_, _).
> +p(Y, Z) :-
> +        Y = X,
> +        Y = f(_, _),
> +        Z = X.
>  @end example

I suggest s/Y/H1/g and s/Z/H2/g.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list