The array indexes in the array range from 0 to the dimension minus one.
For example myarray create with local array(myarray(3,4,5))
contains 60 elements that may be accessed from myarray(0,0,0)
to myarray(2,3,4).
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.
Notes:
local array(A) is equivalent to local array(A, prolog).
It is possible to create arrays with global visibility using
global arrays(A) but this feature will be removed
in future releases.
Success:
local array(a(4)).
local array(b(2,3)).
local array(a(4)), array(a(4,1)).
Error:
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).