See: https://en.wikipedia.org/wiki/Lexicographical_order
Julia's great support for multiple dispatch means that there are roughly two possibilities for encoding new behavior:
- define new types and new methods that dispatch on those types
- define new functions
This package defines new types, and extends existing ordering functions in Base: (isequal, ==, isless)
This choice is consistent with defining new methods for
*(::Complex{T}, ::Complex{T})
instead of defining
complex_times(::NTuple{2, T}, ::NTuple{2,T})
This is important not just for brevity, but also for consistency, because there's an implicit interface with one, zero, :*, :+, inv, :\. The alternative of defining complex_plus, complex_one means that an algorithm that could otherwise be generic cannot.
The implicit "ordering" interface in Julia is smaller, so there wouldn't be many lexico_isless, etc., but by defining a few methods, then :<, :>, :<=, :>= all work in a consistent manner.
For some discussion on these two possible approaches, see: