lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

2015-11-19 6:26 GMT+02:00 Philipp Janda <>:

> Btw., the manual now says:
>> Note that the <code>comp</code> function must define
>> a strict partial order over the elements in the list;
>> that is, it must be asymmetric and transitive.
>> Otherwise, no valid sort may be possible.

> Shouldn't that be a (strict) *total* order (i.e. all elements may
> be compared to each other)?

The total order need not be strict (i.e. it is perfectly OK for
comp(a,b) and comp(b,a) to be both false).

The specification in the manual requires that :

1. comp(a,b) and comp(b,c)    implies    comp(a,c)
2. comp(a,b)    implies   not comp(b,a)