Quark v2.2.0 Quark.Sequence protocol

A protocol for stepping through ordered enumerables

Summary

Functions

The beginning of the sequence

The predessor in the sequence

The successor in sequence

Types

t :: term

Functions

origin(specimen)

Specs

origin(any) :: any

The beginning of the sequence.

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

Examples

origin(9)
#=> 0
pred(element)

Specs

pred(any) :: any

The predessor in the sequence.

For integers, this is the number below.

Examples

pred(10)
#=> 9

42 |> origin |> pred |> pred
#=> -2
succ(element)

Specs

succ(any) :: any

The successor in sequence.

For integers, this is the number above.

Examples

iex> succ(1)
#=> 2

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