[m-rev.] for review: comparison preds/funcs

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Sep 13 02:11:28 AEST 2002


On 13-Sep-2002, Mark Brown <dougl at cs.mu.OZ.AU> wrote:
> This change is in response to the discussion that arose in the recent thread
> on list__sort_and_remove_equivs, and a discussion that was had in person in
> the Mercury office.  The purpose of the change is to clarify what we expect
> of user supplied comparison, and what we mean by "duplicates" in the standard
> library.

This change looks good, thanks.

Just one small comment:

> @@ -166,6 +170,7 @@
> +++ library/builtin.m	12 Sep 2002 06:43:08 -0000
> +	% Values of types comparison_pred/1 and comparison_func/1 are used
> +	% by predicates and functions which depend on an ordering on a given
> +	% type, where this ordering is not necessarily the standard ordering.
> +	% In addition to the type, mode and determinism constraints, a
> +	% comparison predicate C is expected to obey two other laws.  For
> +	% all X, Y and Z of the appropriate type, and for all
> +	% comparison_results R:
> +	%	1) C(X, Y, (>)) if and only if C(Y, X, (<))
> +	%	2) C(X, Y, R) and C(Y, Z, R) implies C(X, Z, R).

I suggest mentioning the names of these laws (symmetry and
transitivity), e.g. by s/1)/(symmetry)/ and s/2)/(transitivity)/

-- 
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