Okasaki.Implementations.AmortizedDeque (Okasaki v1.0.1) View Source

The standard implementation of a deque as a pair of lists.

This implementation is somewhat simpler than the guaranteed constant-time implementation in Queue, but any particular remove might take O(n).

Link to this section Summary

Link to this section Types

Link to this section Functions

Specs

empty(opts :: keyword()) :: t()

Specs

empty?(t()) :: boolean()
Link to this function

insert_left(adeque, item)

View Source

Specs

insert_left(t(), any()) :: t()
Link to this function

insert_right(adeque, item)

View Source

Specs

insert_right(t(), any()) :: t()

Specs

map(t(), (any() -> any())) :: t()

Callback implementation for FunLand.Mappable.map/2.

Specs

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

Specs

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

Specs

size(t()) :: non_neg_integer()
Link to this function

to_list(amortized_deque)

View Source