Next: lib-mutarray, Previous: lib-lmdb, Up: The Prolog Library [Contents][Index]
library(logarr)
This library module provides extendible arrays with logarithmic access time.
Please note: the atom $
is used to indicate an unset element, and the
functor $/4
is used to indicate a subtree. In general, array
elements whose principal function symbol is $
will not work.
Exported predicates:
new_array(-A)
returns a new empty array A.
is_array(+A)
checks whether A is an array.
alist(+Array, -List)
returns a list of pairs Index-Element of all the elements of Array that have been set.
aref(+Index, +Array, -Element)
unifies Element with Array[Index], or fails if Array[Index] has not been set.
arefa(+Index, +Array, -Element)
is as aref/3
, except that it unifies Element with a new array if
Array[Index] is undefined. This is useful for multidimensional
arrays implemented as arrays of arrays.
arefl(+Index, +Array, -Element)
is as aref/3
, except that Element appears as []
for
undefined cells.
aset(+Index, +Array, +Element, -NewArray)
unifies NewArray with the result of setting Array[Index] to Element.