Next: , Previous: , Up: The language   [Contents][Index]


5.20 Queues

A queue is an ordered set of objects, such that objects enter at one end of the queue (the tail), and leave from the other end of the queue (the head). The acts of entering and leaving a queue are often called enqueing and dequeueing.

Librep provides a straightforward queue implementation, implemented by the rep.data.queues module (see Modules).

Function: make-queue

Create and return a new queue object. The queue will initially be empty.

Function: enqueue q arg

Add the object ARG to the tail of the queue q.

Function: dequeue q

Remove the object at the head of the queue q, and return it. If q is empty, an error is signalled.

Function: queue-empty-p q

Return true if the queue q is not empty.

Function: queuep arg

Return true if the object arg is a queue.

Function: queue->list q

Return a list of objects representing the contents of the queue q, with objects ordered from head to tail. Modifying the list structure causes undefined effects to the queue itself.

Function: queue-length q

Return the number of objects stored in the queue q.

Function: delete-from-queue q arg

Removes any occurrences of the object arg from the queue q.