contents index next

17. fsa_m_array: Mutable Arrays

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:

MutableFsaArray:

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.

17.1. List of Predicates

This section lists the predicates defined by this module.

17.1.1. fsa_m_array_new(-MutableFsaArray,[+Size])

Initializes MutableFsaArray as a new mutable array.

17.1.2. fsa_m_array_get(+Index,?Val[,?Default],+MutableFsaArray)

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).

17.1.3. fsa_m_array_put(+Index,?Val,+MutableFsaArray) fsa_m_array_put(+Index,?ValOld,?ValDefault,?Val,+MutableFsaArray)

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.

contents index next