ask/ord

Types

pub type Ord(a) =
  fn(a, a) -> order.Order

Functions

pub fn between(
  ord: fn(a, a) -> Order,
  lower: a,
  upper: a,
) -> fn(a) -> Bool

Test whether a value is between two others, according to a given ordering.

The provided interval is half-open, [lower, upper), i.e. greater than or equal to lower and less than upper.

pub fn clamp(
  ord: fn(a, a) -> Order,
  lower: a,
  upper: a,
) -> fn(a) -> a

Clamp a value to a given range, according to a given ordering.

pub fn combine(
  first: fn(a, a) -> Order,
  second: fn(a, a) -> Order,
) -> fn(a, a) -> Order

Combine two orderings into a new ordering, which will order by the first, then by the second in case of a tie.

pub fn get_equivalence(
  ord: fn(a, a) -> Order,
) -> fn(a, a) -> Bool

Every law-abiding ordering is also an equivalence.

pub fn map_input(
  over ord: fn(a, a) -> Order,
  with fun: fn(b) -> a,
) -> fn(b, b) -> Order

Map the input of an ordering to create a new ordering.

pub fn pair(
  first: fn(a, a) -> Order,
  second: fn(b, b) -> Order,
) -> fn(#(a, b), #(a, b)) -> Order

Create a new ordering for a pair of values based on the given orderings.

pub fn trivial() -> fn(a, a) -> Order

Create a new ordering that always returns order.Eq.

Search Document