Okasaki v0.4.0 Okasaki.Protocols.Queue protocol 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

Link to this function empty?(deque) View Source
empty?(t) :: boolean

True if the queue is empty.

Link to this function insert(queue, item) View Source
insert(t, item :: any) :: t

Inserts a new item to the end of the queue.

Link to this function member?(queue, item) View Source
member?(t, item :: any) :: boolean

Checks if a certain element is part of the queue.

Link to this function remove(queue) View Source
remove(t) :: {:ok, {item :: any, t}} | {:error, :empty}

Removes an item from the front of the queue.

Link to this function size(queue) View Source
size(t) :: non_neg_integer

Returns the number of elements currently in the queue.

Link to this function to_list(queue) View Source
to_list(t) :: list

Converts the queue to a list.