lua-users home
lua-l archive

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


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

A "strict order" means not comp(a,a) (that is, it is irreflexive). Rule
2 above implies strictness (comp(a,a) => not camp(a,a)). Rules 1 and 2
above define a (strict) partial oder. And that is what 'sort' needs.

-- Roberto