Cells

Types of cells

Here, c is the name of the cell:

Note that cells are normally only visible for other cells, but not in defs.

Variable cells

var cells are like global variables (but with propagation to other cells). You can get the value and set it. Note that the expression defining the cell is only evaluated once, at definition time.

Define: var cell c = <expr>

Get the value: c

Where is it allowed to get the value?

Alternative: contents(c) - This is possible everywhere, even in defs. The contents(...) notation makes it clear that there is no automatic propagation, i.e. you get the value of the cell it currently has.

Set the value: c = <expr>.

Where is it allowed to set the value?

Normal and private cells

Normal cells update their value when one of the cells in the defining expression changes its value.

It is not possible to set normal cells.

A normal cell prints the value to the REPL when it changes. When defined inside a module, a normal cell can be linked from the outside of the module.

A private cell does not print values, and is also not accessible at all from outside a module.