Re: Partial orders. Re: Comments on SRFI 128 Draft 5 (2015-11-08).
Sudarshan S Chawathe 10 Nov 2015 21:14 UTC
John Cowan wrote:
> = and < have to work together, and it does say that = must be transitive.
The above was clear to me in the SRFI, and is somewhat tangential to my
question, which is essentially: Are partial orders allowed?
> The whole point of comparators is to define a total order.
This answers that question. It is probably a reasonable design choice,
and certainly the prerogative of the SRFI author. However, it would be
very helpful if the SRFI were very explicit in this regard.
(Although there are a few mentions of total order in the draft, and they
do suggest that a required total order may be the intent, I did not read
them to specifically *require* a total order; rather, I read them to
require certain behavior *if* a total order exists. In particular, the
other specific requirements, such as irreflexivity, transitivity, and
asymmetry do not imply a total order. In any case, it seems to be an
important enough point to be made more prominent, and a single sentence
similar to the quoted one above placed early in the document would be
all that's needed to clarify things.
I will mention also that it may be useful to consider comparators that
reflect underlying partial (not total) orders. A textbook use case
would be using a sorting library (that uses comparators) to sort plane
tickets that are only partially ordered by preference: x is better than
y if x is both a cheaper and a shorter flight than y. (Of course, the
partial order can be mapped to a total order that is consistent with it,
but it seems like an artificial extra step in examples such as this
one.)
Regards,
-chaw