The 'make-array' function creates an array of the specified size and
returns the array. Array elements may be any valid lisp data type, including
lists or arrays. Arrays made by 'make-array' and accessed by
aref are
(setq my-array (make-array 16)) ; make the array (aref my-array 0) ; return 0th (first) element (aref my-array 15) ; return 15th (last) element (aref my-array 16) ; error: non existant element (dotimes (i 16) ; set each element to its index (setf (aref my-array i) i)) ; by the setf function (setq new (make-array 4)) ; make another array (setf (aref new 0) (make-array 4)) ; make new[0] an array of 4 (setf (aref (aref new 0) 1) 'a) ; set new[0,1] = 'a (setf (aref new 2) '(a b c)) ; set new[2] = '(a b c) my-array ; look at array
Read macro: There is a built-in read-macro for arrays, '#' [the hash symbol]. This allows you to create arbitrary arrays with initial values without going through a 'make-array' function. There is also the XLISP vector function to create initialized arrays.
Common Lisp: Common Lisp supports multi-dimensional arrays, XLISP only supports one-dimensional arrays. In XLISP, multi-dimenstional arrays can be created by using 'arrays within arrays'. Common Lisp supports various keyword parameters that are not supported in XLISP.
See the
make-array
function in the