Functional Cells

Denys Duchier

module
x-oz://system/adt/Cell.ozf

This is a functional wrapper around the standard cell datatype.

Exports

The module exports only one function: a New constructor

{Cell.new V}
creates a new instance of a functional cell, initialized with value V.

Instance API

Each functional cell instance C has the following features:

{C.get ?V}
return the current value V of C
{C.put V}
set the current value of C to V
{C.getPut Old New}
atomically, gets the current value Old of C and replaces it with New
{C.clone ?C2}
returns a new functional cell instance, initialized with C's current value