datastructures v0.2.7 Data.Queue.Simple
A simple and performant queue.
Summary
Functions
Dequeue a value from the queue
Check if the queue is empty
Enqueue a value in the queue
Fold the queue from the left
Fold the queue from the right
Check if the the value is present in the queue
Creates an empty queue
Creates a new queue from the given enumerable
Peek the element that would be dequeued
Reverse the queue
Get the size of the queue
Convert the queue to a list
Types
Functions
Dequeue a value from the queue.
Examples
iex> T.new |> Data.Queue.enq(42) |> Data.Queue.enq(23) |> Data.Queue.deq
{42,#Queue<[23]>}
iex> T.new |> Data.Queue.deq(:empty)
{:empty,#Queue<[]>}
Check if the queue is empty.
Enqueue a value in the queue.
Examples
iex> T.new |> Data.Queue.enq(42) |> Data.Queue.enq(23) |> Data.Queue.enq(1337)
#Queue<[42,23,1337]>
Creates an empty queue.
Peek the element that would be dequeued.
Examples
iex> T.new |> Data.Queue.enq(42) |> Data.Queue.peek
42
iex> T.new |> Data.Queue.peek(:empty)
:empty
Get the size of the queue.