This package provides an implementation of extendible arrays with logarithmic access time.
Beware: 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.
To load the package, enter the query
| ?- use_module(library(arrays)).
new_array(-Array)
| ?- new_array(A). A = array($(,,
is_array(+Array)
aref(+Index, +Array, ?Element)
Array[Index]
is undefined.
arefa(+Index, +Array, ?Element)
aref/3
except that Element is a new array if
Array[Index]
is undefined. Example:
| ?- arefa(3, array($(,,,,
arefl(+Index, +Array, ?Element)
aref/3
except that Element is []
for undefined
cells. Example:
| ?- arefl(3, array($(,,
array_to_list(+Array, -List)
| ?- array_to_list(array($(a,b,c,d),2), List). List = [0-a,1-b,2-c,3-d] ? yes
aset(+Index, +Array, +Element, -NewArray)
Array[Index]
to Element. Example:
| ?- aset(3,array($(,,,,a),2) ? yes
Go to the first, previous, next, last section, table of contents.