6.18. kink/ORDER

Features of total order relations backed by `<=` operator, or `op_le` methods.

<= operator

Implementations of `<=` operator should be a total order which satisfies the following for all X, Y, and Z in the domain of the operands.

• reflexive: X <= X

• transitive: if X <= Y && Y <= Z then X <= Z

• antisymmetric: if X <= Y && Y <= X then X == Y

• strongly connected: X <= Y || Y <= X

6.18.1. ORDER.by($extract_key)

`by` returns a function which orders two args by the extracted keys, that is `{(:X :Y) extract_key(X) <= extract_key(Y) }`.

Precondition

$extract_key must be a function which takes one arg.

Example

6.18.2. ORDER.min(X Y)

`min` returns X if X <= Y, otherwise Y.

Precondition

`<=` operator must be defined for `X` and `Y`.

Example

6.18.3. ORDER.max(X Y)

`max` returns X if X >= Y, otherwise Y.

Precondition

`<=` operator must be defined for `X` and `Y`.

Example