ExNumerlo.System behaviour (ExNumerlo v0.4.0)

Copy Markdown View Source

Defines the behaviour for all numeral systems supported by ExNumerlo.

Each system must implement functions for encoding integers, decoding strings, and detecting if a string contains numerals belonging to that system.

Summary

Callbacks

decode(t, keyword)

@callback decode(String.t(), keyword()) :: {:ok, integer()} | {:error, term()}

detect?(t)

@callback detect?(String.t()) :: boolean()

encode(integer, keyword)

@callback encode(integer(), keyword()) :: {:ok, String.t()} | {:error, term()}