2008-02-19 15:38:02 -05:00
USING: help.markup help.syntax kernel ;
IN: boxes
HELP: box
2008-05-15 01:03:21 -04:00
{ $class-description "A data type holding a single value in the " { $snippet "value" } " slot. The " { $snippet "occupied" } " slot indicates if the value is set." } ;
2008-02-19 15:38:02 -05:00
HELP: <box>
{ $values { "box" box } }
{ $description "Creates a new empty box." } ;
HELP: >box
{ $values { "value" object } { "box" box } }
{ $description "Stores a value into a box." }
{ $errors "Throws an error if the box is full." } ;
HELP: box>
{ $values { "box" box } { "value" "the value of the box" } }
{ $description "Removes a value from a box." }
{ $errors "Throws an error if the box is empty." } ;
HELP: ?box
2008-03-11 20:51:58 -04:00
{ $values { "box" box } { "value/f" "the value of the box or " { $link f } } { "?" "a boolean" } }
2008-02-19 15:38:02 -05:00
{ $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" } "." } ;
ARTICLE: "boxes" "Boxes"
"A " { $emphasis "box" } " is a container which can either be empty or hold a single value."
2009-10-01 15:56:36 -04:00
{ $subsections box }
2008-02-19 15:38:02 -05:00
"Creating an empty box:"
2009-10-01 15:56:36 -04:00
{ $subsections <box> }
2008-02-19 15:38:02 -05:00
"Storing a value and removing a value from a box:"
2009-10-01 15:56:36 -04:00
{ $subsections
>box
box>
}
2008-02-19 15:38:02 -05:00
"Safely removing a value:"
2009-10-01 15:56:36 -04:00
{ $subsections ?box }
2008-05-15 01:03:21 -04:00
"Testing if a box is full can be done by reading the " { $snippet "occupied" } " slot." ;
2008-02-19 15:38:02 -05:00
ABOUT: "boxes"