Understanding issorted's lt keyword

The definition Julia uses is that a list is sorted iff for every pair of elements, either:

  1. The elements are equal
  2. 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.

2 Likes