Okasaki.Protocols.Queue protocol (Okasaki v1.0.1) View Source

Link to this section Summary

Functions

True if the queue is empty.

Inserts a new item to the end of the queue.

Checks if a certain element is part of the queue.

Removes an item from the front of the queue.

Returns the number of elements currently in the queue.

Converts the queue to a list.

Link to this section Types

Link to this section Functions

Specs

empty?(t()) :: boolean()

True if the queue is empty.

Specs

insert(t(), item :: any()) :: t()

Inserts a new item to the end of the queue.

Specs

member?(t(), item :: any()) :: boolean()

Checks if a certain element is part of the queue.

Specs

remove(t()) :: {:ok, {item :: any(), t()}} | {:error, :empty}

Removes an item from the front of the queue.

Specs

size(t()) :: non_neg_integer()

Returns the number of elements currently in the queue.

Specs

to_list(t()) :: list()

Converts the queue to a list.