> On 22 déc. 2015, at 18:11, Dave Abrahams <[email protected]> wrote: > Yes, the mathematical definition of lexicographical order (the only > definition that can apply here) is the same everywhere.
Okay. I got sidetracked by “lexicography”. I like to buy dictionaries. This converges on the problem, though: this-precedes-that is *not* the same as this-is-less-than-that. (Maybe we were talking about different things.) Note the signature of sort: func sort(isOrderedBefore: (T, T) -> Bool) -> [T] Not “lessThan”, but “isOrderedBefore”. This proposal would redefine the less-than operator to mean “isOrderedBefore”. It’s been done with String for the sake of convenience, but it should not be generalized. (Again, a function isOrderedBefore<NTupleOfComparables>(t1,t2) would be useful.) Note that there is a proper definition of less-than for vectors. (tuples being generalized vectors). Under that definition, *every* element of vector 1 must be less-than the corresponding elements of vector 2 in order to establish that vector 1 is less-than vector 2. Back to my example: ((0,3,4)<(0,5,0)) is false and ((0,3,4)>(0,5,0)) is false. One may well be ordered before the other. Cheers, Guillaume Lessard _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
