View Source Quark.Sequence protocol (Quark v2.3.3-doma)

A protocol for stepping through ordered enumerables

Link to this section Summary

Functions

The beginning of the sequence.

The predessor in the sequence.

The successor in sequence.

Link to this section Types

Link to this section Functions

@spec origin(any()) :: any()

The beginning of the sequence.

For instance, integers are generally thought of as centering around 0.

examples

Examples

origin(9)
#=> 0
@spec pred(any()) :: any()

The predessor in the sequence.

For integers, this is the number below.

examples

Examples

pred(10)
#=> 9

42 |> origin() |> pred() |> pred()
#=> -2
@spec succ(any()) :: any()

The successor in sequence.

For integers, this is the number above.

examples

Examples

iex> succ(1)
#=> 2

iex> 10 |> origin() |> succ() |> succ()
#=> 2