Next: srfi boxes copyright, Previous: srfi boxes rationale, Up: srfi boxes [Index]
The following procedures implement the box type (which is disjoint from
all other Scheme types), and are exported by the libraries (srfi
:111)
and (srfi :111 boxes)
.
Constructor. Return a newly allocated box initialized to obj.
Predicate. Return #t
if obj is a box, and #f
otherwise.
Accessor. Return the current value of box/obj.
For Vicare: if box/obj is not a box object, no error is raised and the return value is box/obj itself.
Mutator. Change box to hold new-obj.
The behavior of boxes with the equivalence predicates eq?
,
eqv?
, and equal?
is the same as if they were implemented
with records. That is, two boxes are both eq?
and eqv?
if, and only if, they are the product of the same call to box
and
not otherwise, and while they must be equal?
if they are
eqv?
, the converse is implementation–dependent.
For Vicare: two boxes produced by distinct call to
box
and holding the same object areequal?
but noteqv?
.
The following provisions of this SRFI are optional:
+
) but receives a box instead may, if appropriate, unbox the box.
Procedures that accept arguments of any type (such as cons
) must
not unbox their arguments.
unbox
on a non–box may simply return the non–box.
Next: srfi boxes copyright, Previous: srfi boxes rationale, Up: srfi boxes [Index]