factor/library/collections/queues.facts

27 lines
894 B
Plaintext

IN: queues
USING: help ;
HELP: queue
{ $class-description "A simple first-in-first-out queue. See " { $link "queues" } "." } ;
HELP: <queue>
{ $values { "queue" "a new queue" } }
{ $description "Makes a new queue with no elements." } ;
HELP: queue-empty?
{ $values { "queue" "a queue" } { "?" "a boolean" } }
{ $description "Tests if a queue contains no elements." } ;
HELP: deque
{ $values { "queue" "a queue" } { "elt" "an object" } }
{ $description "Removes an element from the front of the queue." }
{ $errors "Throws an " { $link empty-queue } " error if the queue has no entries." } ;
HELP: enque
{ $values { "elt" "an object" } { "queue" "a queue" } }
{ $description "Adds an element to the back of the queue." } ;
HELP: empty-queue
{ $description "Throws an " { $link empty-queue } " error." }
{ $error-description "Thrown by " { $link deque } " if the queue has no entries." } ;