Download ciao Reference Manual - pdf

Transcript
Chapter 154: Extendable arrays with logarithmic access time
633
154 Extendable arrays with logarithmic access time
Author(s): Lena Flood.
Version: 1.10#6 (2004/8/7, 21:46:39 CEST)
Version of last change: 1.9#236 (2003/12/22, 18:18:14 CET)
This module implements extendable arrays with logarithmic access time. It has been adapted
from shared code written by David Warren and Fernando Pereira.
154.1 Usage and interface (arrays)
®
©
• Library usage:
:- use_module(library(arrays)).
• Exports:
− Predicates:
new_array/1, is_array/1, aref/3, arefa/3, arefl/3, aset/4, array_to_list/2.
­
ª
154.2 Documentation on exports (arrays)
new array/1:
PREDICATE
Usage: new_array(-Array)
− Description: returns an empty new array Array.
is array/1:
PREDICATE
Usage: is_array(+Array)
− Description: Array actually is an array.
aref/3:
PREDICATE
Usage: aref(+Index, +Array, ?Element)
− Description: unifies Element to Array[Index], or fails if Array[Index] has not been
set.
arefa/3:
PREDICATE
Usage: arefa(+Index, +Array, ?Element)
− Description: 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.