Okasaki v0.4.0 Okasaki.Implementations.AmortizedQueue View Source

The standard implementation of a queue 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_queue) View Source
empty?(t) :: boolean
Link to this function insert(aqueue, item) View Source
insert(t, any) :: t
Link to this function map(queue, fun) View Source
map(t, (any -> any)) :: t
Link to this function remove(aqueue) View Source
remove(t) :: {:ok, {any, t}} | {:error, :empty}
Link to this function size(amortized_queue) View Source
size(t) :: non_neg_integer
Link to this function to_list(amortized_queue) View Source