Next: , Up: actor-lib A standard library of sorts   [Contents]


6.1 Cells

The (goblins actor-lib cell) module provides a very handy actor called a “cell.” Cells are used to store arbitrary data.

New cells are created with the constructor ^cell:

> (define chest (spawn ^cell 'gold))

The current value of a cell can be retrieved by sending an empty message to the cell:

> ($ chest)
=> gold

The value of a cell can be changed by sending a message containing the new value:

> ($ chest 'sword)
> ($ chest)
=> sword