]> gitweb.factorcode.org Git - factor.git/blob - basis/boxes/boxes-docs.factor
core, basis, extra: Remove DOS line endings from files.
[factor.git] / basis / boxes / boxes-docs.factor
1 USING: help.markup help.syntax kernel ;
2 IN: boxes
3
4 HELP: box
5 { $class-description "A data type holding a single value in the " { $snippet "value" } " slot. The " { $snippet "occupied" } " slot indicates if the value is set." } ;
6
7 HELP: <box>
8 { $values { "box" box } }
9 { $description "Creates a new empty box." } ;
10
11 HELP: >box
12 { $values { "value" object } { "box" box } }
13 { $description "Stores a value into a box." }
14 { $errors "Throws an error if the box is full." } ;
15
16 HELP: box>
17 { $values { "box" box } { "value" "the value of the box" } }
18 { $description "Removes a value from a box." }
19 { $errors "Throws an error if the box is empty." } ;
20
21 HELP: ?box
22 { $values { "box" box } { "value/f" "the value of the box or " { $link f } } { "?" boolean } }
23 { $description "If the box is full, removes the value from the box and pushes " { $link t } ". If the box is empty pushes " { $snippet "f f" } "." } ;
24
25 ARTICLE: "boxes" "Boxes"
26 "A " { $emphasis "box" } " is a container which can either be empty or hold a single value."
27 { $subsections box }
28 "Creating an empty box:"
29 { $subsections <box> }
30 "Storing a value and removing a value from a box:"
31 { $subsections
32     >box
33     box>
34 }
35 "Safely removing a value:"
36 { $subsections ?box }
37 "Testing if a box is full can be done by reading the " { $snippet "occupied" } " slot." ;
38
39 ABOUT: "boxes"