Re: Partial orders. Re: Comments on SRFI 128 Draft 5 (2015-11-08).
John Cowan 10 Nov 2015 02:49 UTC
Sudarshan S Chawathe scripsit:
> (make-comparator exact-integer?
> =
> (lambda (i j)
> (and (even? i)
> (even? j)
> (< i j)))
> number-hash)
This clearly violates the programmer's responsibilities section, as
I said before. The ordering predicate is required to be asymmetric.
An asymmetric predicate is one in which, for all values of a and b,
if (pred a b) is true than (pred b a) is false. This is obviously not
true here, so what you have is a comparator whose behavior when passed
to standard routines is undefined.
> The main question here is whether the SRFI requires comparators to
> totally order all elements accepted by their type-test predicates, or
> whether it is OK if none (1st example) or only some (2nd) are ordered.
In a word, it is not OK.
--
John Cowan http://www.ccil.org/~cowan xxxxxx@ccil.org
Is not a patron, my Lord [Chesterfield], one who looks with unconcern
on a man struggling for life in the water, and when he has reached ground
encumbers him with help? --Samuel Johnson