Next: Queues, Previous: Integer enumerations, Up: System features
Scheme48 also provides a simple mutable cell data type from the
cells
structure. It uses them internally for local, lexical
variables that are assigned, but cells are available still to the rest
of the system for general use.
Make-cell
creates a new cell with the given contents.Cell?
is the disjoint type predicate for cells.Cell-ref
returns the current contents of cell.Cell-set!
assigns the contents of cell to value.
Examples:
(define cell (make-cell 42)) (cell-ref cell) => 42 (cell? cell) => #t (cell-set! cell 'frobozz) (cell-ref cell) => frobozz