This module defines the box datatype, which is a simple container that can hold one Scheme object. It can be used as a minimal data storage, or a sort of mutable indirect “pointer”.
Traditionally a pair (with ignoring its cdr) or a single-element vector has been used for this purpose; in modern Scheme you can also define a record type with one mutable field. Nevertheless, a box is very common abstraction to describe various algorithms, and having common interface to it is useful.
The srfi leaves some details to implementations. Here are our choices:
equal?compares their contents when two are not
eqv?. In the spec, when two boxes are
eqv?then they must also be
equal?to each other, but it’s up to the implementation when two are not
Returns a fresh box object that contains the value
#t iff obj is a box object.
Returns box’s content.
Mutate box’s content with val. Returns unspecified value.