Added docs

This commit is contained in:
Justin Ethier 2016-09-30 17:09:00 -04:00
parent dfb502abe3
commit 2f5baac5a5

View file

@ -1,21 +1,24 @@
# SRFI 111 - Boxes # SRFI 111 - Boxes
The `(srfi 111)` library ... The `(srfi 111)` library defines boxes, a container for an object of any Scheme type, including another box. Boxes are normally used as minimal mutable storage, and can inject a controlled amount of mutability into an otherwise immutable data structure (or one that is conventionally treated as immutable).
See the [SRFI document](http://srfi.schemers.org/srfi-111/srfi-111.html) for more information. See the [SRFI document](http://srfi.schemers.org/srfi-111/srfi-111.html) for more information.
##- [`and-let*`](#and-let) - [`box`] (#box)
## - [`box?`] (#box-1)
###and-let* - [`unbox`] (#unbox)
## (and-let* (claws) body - [`set-box!`](#set-box)
##
## claws ::= '() | (cons claw claws) #box
## claw ::= (variable expression) | (expression) | (box value)
## bound-variable Constructor. Returns a newly allocated box initialized to value.
## #box?
##- The `claws` are evaluated in the strict left-to-right order (box? object)
##- For each `claw`, the `expression` part is evaluated first (or `bound-variable` is looked up) Predicate. Returns #t if object is a box, and #f otherwise.
##- If the result is #f, `and-let*` immediately returns #f #unbox
##- Otherwise, if the `claw` is of the form `(variable expression)` the `expression`'s value is bound to a freshly made `variable` (unbox box)
##- The `variable` is available for the rest of the `claws` , and the `body` Accessor. Returns the current value of box.
##- As usual, all `variable`s must be unique (like in `let*`) #set-box!
(set-box! box value)
Mutator. Changes box to hold value.