queue(3)

MODULE
queue - Abstract Data Type for FIFO Queues

DESCRIPTION

This module implements FIFO queues in an efficient manner.

EXPORTS

new() -> Queue

    Types
        Queue = queue()

    Returns an empty queue.

in(Item, Q1) -> Q2

    Types
        Item = term()
        Q1 = Q2 = queue()

    Inserts Item into the queue Q1. Returns a new queue Q2.

out(Q) -> Result

    Types
        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.

to_list(Q) -> list()

    Types
        Q = queue()

    Returns a list of the elements in the queue, with the oldest element first.

AUTHOR
Claes Wikstrom - support@erlang.ericsson.se