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

Deque is an implementation of Chris Okasaki's Purely Functional Deque

This means that pushing and popping to both ends of the double-ended-queue happen in constant (O(1)) time.

For the paper upon which this is based: http://www.westpoint.edu/eecs/SiteAssets/SitePages/Faculty Publication Documents/Okasaki/jfp95queue.pdf

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(deque, item)

View Source

Specs

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

insert_right(deque, item)

View Source

Specs

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

Specs

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

Callback implementation for FunLand.Mappable.map/2.

Specs

member?(t(), item :: any()) :: boolean()

Specs

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

Specs

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

Specs

size(t()) :: non_neg_integer()

Specs

to_list(t()) :: list()