This module provides a mutable array datastructure. The arrays are implemented using O'Keefe's N+K trees, with N=127 and K=32.
NB. Array indices start at 0: so 0 refers to the first element of the array.
Here's an overview of the predicates provided:
fsa_m_array_new/[1,2] create a new mutable array
fsa_m_array_get/3 lookup a value from a mutable array
fsa_m_array_put/[3,5] update a value in a mutable array
The N+K tree data-structure is described in The Craft of Prolog, by Richard A. O'Keefe, MIT Press, 1990, chapters 4.5. and 4.6.
This section lists the predicates defined by this module.
Initializes MutableFsaArray as a new mutable array.
Val is unified with the Index'th entry in MutableFsaArray. The predicate succeeds if that entry has not yet been set, without binding Val (first form); or it binds Val to Default (second form).
The Index'th entry in MutableFsaArray is updated to Val (using the SICStus built-in update_mutable/create_mutable). ValOld will be bound to the old value, or to ValDefault if no value existed.