3.9 Vectors

Vectors are structured entities in which random elements may be accessed with an integer index. A vector has a single dimension. Its maximum size is determined by the implementation and available space. A suggested input “vector notation” is defined in “Classes of Primitive Data Types”, section 2.2 on page 12 and output with EXPLODE, “Identifiers” section 3.3 on page 27.

GETV(V:vector, INDEX:integer):any eval, spread
 
Returns the value stored at position INDEX of the vector V. The type mismatch error may occur. An error occurs if the INDEX does not lie within 0…UPBV(V) inclusive:

***** INDEX subscript is out of range

MKVECT(UPLIM:integer):vector eval, spread
 
Defines and allocates space for a vector with UPLIM+1 elements accessed as 0…UPLIM. Each element is initialized to NIL. An error will occur if UPLIM is < 0 or there is not enough space for a vector of this size:

***** A vector of size UPLIM cannot be allocated

PUTV(V:vector, INDEX:integer, VALUE:any):any eval, spread
 
Stores VALUE into the vector V at position INDEX. VALUE is returned. The type mismatch error may occur. If INDEX does not lie in 0…UPBV(V) an error occurs:

***** INDEX subscript is out of range

UPBV(U:any):NIL,integer eval, spread
 
Returns the upper limit of U if U is a vector, or NIL if it is not.