View Source Witchcraft.Ord.Proto protocol (Witchcraft v1.0.6-doma)
Protocol for the Elixir.Witchcraft.Ord
type class
For this type class's API, please refer to Elixir.Witchcraft.Ord
Link to this section Summary
Functions
Get the ordering relationship between two elements.
Link to this section Types
@type t() :: term()
Link to this section Functions
@spec compare(Witchcraft.Ord.t(), Witchcraft.Ord.t()) :: Witchcraft.Ord.ordering()
Get the ordering relationship between two elements.
Possible results are :lesser
, :equal
, and :greater
examples
Examples
iex> compare(1, 1)
:equal
iex> compare([1], [2])
:lesser
iex> compare([1, 2], [3])
:lesser
iex> compare([3, 2, 1], [1, 2, 3, 4, 5])
:greater