factor/library/collections/queues.facts

27 lines
975 B
Plaintext
Raw Normal View History

2005-12-30 03:57:38 -05:00
IN: queues
USING: help ;
2006-08-01 17:35:00 -04:00
HELP: queue f
{ $class-description "A simple first-in-first-out queue. See " { $link "queues" } "." } ;
2005-12-30 03:57:38 -05:00
HELP: <queue> "( -- queue )"
{ $values { "queue" "a new queue" } }
{ $description "Makes a new queue with no elements." } ;
HELP: queue-empty? "( queue -- ? )"
{ $values { "queue" "a queue" } { "?" "a boolean" } }
{ $description "Tests if a queue contains no elements." } ;
HELP: deque "( queue -- elt )"
{ $values { "queue" "a queue" } { "elt" "an object" } }
2006-08-01 17:35:00 -04:00
{ $description "Removes an element from the front of the queue." }
{ $errors "Throws an " { $link empty-queue } " error if the queue has no entries." } ;
2005-12-30 03:57:38 -05:00
HELP: enque "( elt queue -- )"
{ $values { "elt" "an object" } { "queue" "a queue" } }
{ $description "Adds an element to the back of the queue." } ;
2006-08-01 17:35:00 -04:00
HELP: empty-queue "( -- )"
{ $description "Throws an " { $link empty-queue } " error." }
{ $error-description "Thrown by " { $link deque } " if the queue has no entries." } ;