Okasaki v0.4.0 Okasaki.Implementations.AmortizedDeque 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

Link to this function empty(opts \\ []) View Source
empty(opts :: keyword) :: t
Link to this function empty?(amortized_deque) View Source
empty?(t) :: boolean
Link to this function insert_left(adeque, item) View Source
insert_left(t, any) :: t
Link to this function insert_right(adeque, item) View Source
insert_right(t, any) :: t
Link to this function map(deque, fun) View Source
map(t, (any -> any)) :: t
Link to this function remove_left(adeque) View Source
remove_left(t) :: {:ok, {any, t}} | {:error, :empty}
Link to this function remove_right(adeque) View Source
remove_right(t) :: {:ok, {any, t}} | {:error, :empty}
Link to this function size(amortized_deque) View Source
size(t) :: non_neg_integer
Link to this function to_list(amortized_deque) View Source