5.	ARRAYS

 
An array in Interlisp is an object representing a one-dimensional vector of objects.  Arrays are generally created by the function ARRAY.
(ARRAY SIZE TYPE INIT ORIG ---)  	[Function]
Creates and returns a new array capable of containing SIZE objects of type TYPE.  If TYPE is NIL, the array can contain any arbitrary Lisp datum.  In general, TYPE may be any of the various field specifications which are legal in DATATYPE declarations (see page X.XX): POINTER, FIXP, FLOATP, (BITS N), etc.  The implementation will, if necessary, choose an "enclosing" type if the given one is not supported; for example, an array of (BITS 3) may be represented by an array of (BITS 8).
INIT is the initial value in each element of the new array.  If not specified, the array elements will be initialized with 0 (for number arrays) or NIL (all other types).
Arrays can have either 0-origin or 1-origin indexing, as specified by the ORIG argument; if ORIG is not specified, the default is 1. 
Note:  Arrays of type FLOATP are stored unboxed.  This increases the space and time efficiency of FLOATP arrays.  Users who want to use boxed floating point numbers should use an array of type POINTER instead of FLOATP.

(ARRAYP X)  	[Function]
Returns X if X is an array, NIL otherwise.
Note:  In some implementations of Interlisp (but not Interlisp-D), ARRAYP may also return X if it is of type CCODEP or HARRAYP.

(ELT ARRAY N)  	[Function]
Returns the Nth element of the array ARRAY.
Generates the error ARG NOT ARRAY if ARRAY is not an array.  Generates the error ILLEGAL ARG if N is out of bounds.

(SETA ARRAY N V)  	[Function]
Sets the Nth element of the array ARRAY to VAL, and returns VAL.
Generates the error ARG NOT ARRAY if ARRAY is not an array.  Generates the error ILLEGAL ARG if N is out of bounds.  Can generate the error NON-NUMERIC ARG if ARRAY is an array whose ARRAYTYP is FIXP or FLOATP and VAL is non-numeric.

(ARRAYTYP ARRAY)  	[Function]
Returns the type of the elements in the array ARRAY, a value corresponding to the second argument to ARRAY.
Note:  If ARRAY coerced the array type as described above, ARRAYTYP will return the new type.  For example, (ARRAYTYP (ARRAY 10 '(BITS 3))) will return BYTE in Interlisp-D, and FIXP in Interlisp-10.

(ARRAYSIZE ARRAY)  	[Function]
Returns the size of array ARRAY. Generates the error, ARG NOT ARRAY, if ARRAY is not an array.

(ARRAYORIG ARRAY)  	[Function]
Returns the origin of array ARRAY, which may be 0 or 1.  Generates an error, ARG NOT ARRAY, if ARRAY is not an array.

(COPYARRAY ARRAY)  	[Function]
Returns a new array of the same size and type as ARRAY, and with the same contents as ARRAY.  Generates an ARG NOT ARRAY error, if ARRAY is not an array.


Copyright (c) 1985 Xerox Corporation.  All rights reserved.