1 USING: help.markup help.syntax kernel ;
4 ARTICLE: "queues" "Queues"
5 "Last-in-first-out queues are defined in the " { $vocab-link "queues" } " vocabulary."
10 { $subsection <queue> }
12 { $subsection queue-empty? }
17 { $subsection clear-queue }
18 { $subsection queue-each }
36 { $class-description "A simple first-in-first-out queue. See " { $link "queues" } "." } ;
39 { $class-description "The class of entries in a " { $link queue } ". Each entry holds an object and a reference to the next entry." } ;
42 { $values { "obj" object } { "entry" entry } }
43 { $description "Creates a new queue entry." }
44 { $notes "This word is a factor of " { $link enque } "." } ;
47 { $values { "queue" queue } }
48 { $description "Makes a new queue with no elements." } ;
51 { $values { "queue" queue } { "?" "a boolean" } }
52 { $description "Tests if a queue contains no elements." } ;
55 { $values { "queue" queue } { "elt" object } }
56 { $description "Removes an element from the front of the queue." }
57 { $errors "Throws an " { $link empty-queue-error } " if the queue has no entries." }
58 { $side-effects "queue" } ;
61 { $values { "elt" object } { "queue" queue } }
62 { $description "Adds an element to the back of the queue." }
63 { $side-effects "queue" } ;
65 HELP: empty-queue-error
66 { $description "Throws an " { $link empty-queue-error } "." }
67 { $error-description "Thrown by " { $link deque } " if the queue has no entries." } ;
70 { $values { "queue" queue } }
71 { $description "Removes all entries from the queue." }
72 { $side-effects "queue" } ;
75 { $values { "queue" queue } { "quot" "a quotation with stack effect " { $snippet "( obj -- )" } } }
76 { $description "Applies the quotation to each entry in the queue, starting from the least recently added entry, clearing the queue in the process." }
77 { $side-effects "queue" } ;