The definition Julia uses is that a list is sorted iff for every pair of elements, either:
- The elements are equal
- The first element is less than the second
The reason for this design is it only relies on users to define ==(a::T,b::T)
and <(a::T,b::T)
.
The reason to define sort
in terms of the more fundamental function is to increase the chance that user defined methods will be used when applicable.