6.4
1 Imperative Queues
This module provides a simple mutable queue representation,
providing first-in/first-out semantics.
Operations on queues mutate it in a thread-unsafe way.
Produces an empty queue.
Adds an element to the back of a queue.
This takes constant time, independent of the number
of elements in q.
Adds an element to the front of a queue.
This takes constant time, independent of the number
of elements in q.
Removes an element from the front of a non-empty queue, and returns that
element.
This takes constant time, independent of the number
of elements in q.
Examples:
Applies pred? to each element of the queue,
removing any where pred? returns #f.
This takes time proportional to the number of elements in q
(assuming that pred? takes constant time, independent
of the number of elements in q). It does not allocate and
it calls pred? exactly once for each element of q.
Examples:
Returns an immutable list containing the elements of the queue
in the order the elements were added.
This takes time proportional to the number of elements in q.
Examples:
Returns the number of elements in the queue.
This takes constant time, independent of the number
of elements in q.
Examples:
Recognizes whether a queue is empty or not.
This takes constant time, independent of the number
of elements in q.
Examples:
This predicate recognizes queues.
This takes constant time, independent of the
size of the argument v.
Examples:
This predicate recognizes non-empty queues.
This takes constant time, independent of the
size of the argument v.
Examples:
Returns a sequence whose elements are the elements of
queue.
These are provided for backwards compatibility. They are
identical to
queue? and
non-empty-queue?,
respectively.