Okasaki.Implementations.AmortizedQueue (Okasaki v1.0.1) 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

Specs

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

Specs

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

Specs

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

Specs

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

Callback implementation for FunLand.Mappable.map/2.

Specs

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

Specs

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

to_list(amortized_queue)

View Source