This module implements FIFO queues in an efficient manner.
Queue = queue()
Returns an empty queue.
Item = term()
Q1 = Q2 = queue()
Inserts Item
into the queue Q1
. Returns a new queue Q2
.
Result = {{value, Item}, Q1} | {empty, Q1}
Q = Q1 = queue()
Removes the oldest element from the queue Q
.
Returns the tuple {{value, Item}, Q1}
, where Item
is
the element removed and Q1
is an identifier for the new queue.
If Q
is empty, the tuple {empty, Q}
is returned.
Q = queue()
Returns a list of the elements in the queue, with the oldest element first.