ARRAY

Synopsis
ARRAY size
(ARRAY size origin)
Description

Outputs an array of size elements (must be a positive integer), each of which initially is an empty list. Array elements can be selected with ITEM and changed with SETITEM. The first element of the array is element number 1, unless an origin input (must be an integer) is given, in which case the first element of the array has that number as its index. (Typically 0 is used as the origin if anything.) Arrays are printed by PRINT and friends, and can be typed in, inside curly braces; indicate an origin with {a b c}@0.

You can get the origin of an array with FIRST.

Example
MAKE "myarray (ARRAY 3 0)
SETITEM 2 :myarray 1
SETITEM 1 :myarray 2
SETITEM 0 :myarray 3
SHOW :myarray
{3 2 1}

SourceForge.net Logo