The 'aref' function returns the specified element out of a previously
created 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 '#(0 1 2 3 4)) => #(0 1 2 3 4) (aref my-array 0) => 0 (aref my-array 4) => 4 (aref my-array 5) => error: array index out of bounds - 5 my-array => #(0 1 2 3 4) (setq new (make-array 4)) => #(NIL NIL NIL NIL) (setf (aref new 0) (make-array 4)) => #(NIL NIL NIL NIL) new => #(#(NIL NIL NIL NIL) NIL NIL NIL) (setf (aref (aref new 0) 1) 'a) => A new => #(#(NIL A NIL NIL) NIL NIL NIL) (setf (aref new 2) '(a b c)) => (A B C) new => #(#(NIL A NIL NIL) NIL (A B C) NIL)
Read macro: There is a built-in read-macro for arrays,
Note: This function returns the value of an array element.
However, there is no equivalent direct function to set the value of an array
element to some value.
See also: