This is a trivial module, providing objects with a single mutable state. Several Schemes have something like it, sometimes called cells. Boxes are a disjoint type.
Proposed |
Racket |
Gambit |
SISC |
Chez |
Chicken |
MIT |
Scheme48 |
box |
box |
box |
box |
box |
make-box |
make-cell |
make-cell |
box? |
box? |
box? |
box? |
box? |
box-mutable? |
cell? |
cell? |
unbox |
unbox |
unbox |
unbox |
unbox |
box-ref |
cell-contents |
cell-ref |
set-box! |
set-box! |
set-box! |
set-box! |
set-box! |
box-set! |
set-cell-contents! |
cell-set! |
Racket, Gambit, SISC, Chez, and Chicken all support #& to create a box initialized with the object represented by the following datum.