Funx.Ord.Any (funx v0.8.4)

View Source

Provides default ordering functions using the Funx.Ord.Protocol.

This module delegates to the protocol implementation for the given type, falling back to Elixir's built-in comparison operators when no protocol implementation exists.

Summary

Functions

Returns true if a is greater than or equal to b.

Returns true if a is greater than b.

Returns true if a is less than or equal to b.

Returns true if a is less than b according to their Ord.Protocol implementation.

Functions

ge?(a, b)

@spec ge?(any(), any()) :: boolean()

Returns true if a is greater than or equal to b.

Examples

iex> Funx.Ord.Any.ge?(2, 1)
true

iex> Funx.Ord.Any.ge?(2, 2)
true

gt?(a, b)

@spec gt?(any(), any()) :: boolean()

Returns true if a is greater than b.

Examples

iex> Funx.Ord.Any.gt?(2, 1)
true

iex> Funx.Ord.Any.gt?(1, 2)
false

le?(a, b)

@spec le?(any(), any()) :: boolean()

Returns true if a is less than or equal to b.

Examples

iex> Funx.Ord.Any.le?(1, 2)
true

iex> Funx.Ord.Any.le?(2, 2)
true

lt?(a, b)

@spec lt?(any(), any()) :: boolean()

Returns true if a is less than b according to their Ord.Protocol implementation.

Examples

iex> Funx.Ord.Any.lt?(1, 2)
true

iex> Funx.Ord.Any.lt?(2, 1)
false