]> gitweb.factorcode.org Git - factor.git/blob - basis/boxes/boxes-docs.factor
Fix permission bits
[factor.git] / basis / boxes / boxes-docs.factor
1 USING: help.markup help.syntax kernel ;\r
2 IN: boxes\r
3 \r
4 HELP: box\r
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." } ;\r
6 \r
7 HELP: <box>\r
8 { $values { "box" box } }\r
9 { $description "Creates a new empty box." } ;\r
10 \r
11 HELP: >box\r
12 { $values { "value" object } { "box" box } }\r
13 { $description "Stores a value into a box." }\r
14 { $errors "Throws an error if the box is full." } ;\r
15 \r
16 HELP: box>\r
17 { $values { "box" box } { "value" "the value of the box" } }\r
18 { $description "Removes a value from a box." }\r
19 { $errors "Throws an error if the box is empty." } ;\r
20 \r
21 HELP: ?box\r
22 { $values { "box" box } { "value/f" "the value of the box or " { $link f } } { "?" "a boolean" } }\r
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" } "." } ;\r
24 \r
25 ARTICLE: "boxes" "Boxes"\r
26 "A " { $emphasis "box" } " is a container which can either be empty or hold a single value."\r
27 { $subsection box }\r
28 "Creating an empty box:"\r
29 { $subsection <box> }\r
30 "Storing a value and removing a value from a box:"\r
31 { $subsection >box }\r
32 { $subsection box> }\r
33 "Safely removing a value:"\r
34 { $subsection ?box }\r
35 "Testing if a box is full can be done by reading the " { $snippet "occupied" } " slot." ;\r
36 \r
37 ABOUT: "boxes"\r