(queue-empty? )→ #t if the queue is empty, else #f.
(queue-enter! object)→ void, enters the object in the queue.
(queue-extract! [thunk])→ removes an object from the queue and returns that object.
(queue-peek [thunk])→ returns the next object of the queue without removing it.
(queue-remove! [thunk])→ void, removes an object from the queue.
(queue->list )→ copy of the queue (a newly allocated immutable list with the same (
eq?) contents as the queue)
queue-remove!return whatever is returned by the thunk or signal an error if no thunk is supplied. The procedures are prepared by means of procedure
(make-queue [string])→ multiple value of six procedures The optional string is used in error messages in order to identify the queue. It has no other use. The default string is
"no name". The internal representation for the queue is a mutable list containing the entered objects in the reversed order, i.e. the most recent one at the end and the oldest one at the start. Procedure
queue-enter!appends an object at the end of the queue. This is done in situ (i.e. destructively) Procedures
queue-remove!apply to the first element of the queue. Procedures
queue-remove!replace the queue by its cdr, thus removing the oldest element. A simple, but inefficient implementation (without names, thunks or error-detection) is 500 Can't connect to 127.0.0.1:8778 (connect: Connection refused) In this implementation, procedure
queue-enter!is inefficient, because it calls procedure
last-pair, which does a full traversal of the queue. In order to avoid this traversal, the last pair must be memorized: 500 Can't connect to 127.0.0.1:8778 (connect: Connection refused) Example of use: 500 Can't connect to 127.0.0.1:8778 (connect: Connection refused) Now it is a matter of routine in order to prepare the full implemention, name, thunk arguments and error detection included: 500 Can't connect to 127.0.0.1:8778 (connect: Connection refused) A good alternative is to implement the queues as a class of objects with two private variables
name: 500 Can't connect to 127.0.0.1:8778 (connect: Connection refused)