[ Non-logical Variables, Arrays, Bags, Shelves and Stores | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]
Creates the untyped non-logical array Array.
- Ground compound term with integer arguments.
If Array is a compound term, a non-logical array (visible only in
the caller module) of type prolog is created. Its dimension is the
arity of the term Array and the size of each dimension is specified
by the corresponding argument of the term Array. The elements of
arrays of type prolog are initialised to free variables.
The array indexes in the array range from 0 to the dimension minus one.
For example myarray create with
contains 60 elements that may be accessed from myarray(0,0,0)
The contents of the array persists across failures.
The value of the array elements can be changed with
setval/2 and retrieved with getval/2. Setting and retrieving terms
from a non-logical arrays involves copying the term each time.
In particular, if the term contains variables, they lose their
identity and are replaced with fresh ones.
local array(A) is equivalent to
local array(A, prolog).
Modes and Determinism
- (4) instantiation fault
- Array is not ground.
- (5) type error
- Array is not a structure with integer arguments.
- (6) out of range
- The ground structure Array has arguments that are integers not greater than 0.
- (24) number expected
- The ground structure Array has arguments that are non-numbers.
- (42) redefining an existing array
- An array with the same name and dimension as Array already exists.
local array(a(4)), array(a(4,1)).
local array(X). (Error 4).
local array(a(6.0)). (Error 5).
local array(a(0)). (Error 6).
local array(a(-2)). (Error 6).
local array(a(4)), array(a(5)). (Warning 42).
current_array / 2, array / 2, decval / 1, incval / 1, bag_create / 1, shelf_create / 2, shelf_create / 3, getval / 2, setval / 2