[m-rev.] for review: user-defined comparison

Simon Taylor stayl at cs.mu.OZ.AU
Wed Jul 10 17:06:14 AEST 2002


On 10-Jul-2002, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> This reminds me of something I've considered doing for a while, namely
> adding the following to builtin.m:
> 
> :- pred T < T.
> :- mode in < in is semidet.
> 
> X < Y :- compare((<), X, Y).
> 
> and so on for (=<), (>), (>=) and getting rid of (<) etc. in int.m and
> float.m.
> 
> This would allow us to use inequalities on all terms, not just ints and
> floats.
> 
> Would this lead to any grief?

I don't think so. The compiler would have to work harder to optimize
it, but I don't think that's a big problem.

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