A set of items in which only the earliest added item may be accessed. Basic operations are add (to the tail) or enqueue and delete (from the head) or dequeue. Delete returns the item removed.

Note: It is convenient to define delete or dequeue in terms of front and remove. The operations new(), add(v, Q), front(Q), and remove(Q) may be defined with the following.


new() returns a queue
front(add(v, new())) = v
remove(add(v, new())) = new()
front(add(v, add(w, Q))) = front(add(w, Q))
remove(add(v, add(w, Q))) = add(v, remove(add(w, Q)))
where Q is a queue and v and w are values.

Log in or register to write something here or to contact authors.