Author goretkin
1 Star
Updated Last
2 Years Ago
Started In
March 2020


pipeline status coverage report Build Status Coverage Status codecov

See: https://en.wikipedia.org/wiki/Lexicographical_order

Design rationale

Julia's great support for multiple dispatch means that there are roughly two possibilities for encoding new behavior:

  1. define new types and new methods that dispatch on those types
  2. 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: