array | an array |
subscripts | a list of valid array indices |
AREF function accesses specified elements of arrays. Every array index is counted from zero. Accessing out-of-bounds indices signals condition, or causes crash and/or undefined behavior, depending on compilation safety mode. Note that vectors (including strings which are special vectors) are treated as one dimensional arrays so aref works on them too.
AREF with conjunction of SETF may be used to set array elements.
(aref "hola" 0) => #\h (aref "hola" 3) => #\a (aref #(5 3 6 8) 1) => 3 (aref (make-array '(10 10) :initial-element 'moo) 9 9) => MOO
(let ((a (make-array '(3 3) :initial-element 'moo))) (setf (aref a 1 1) 'x) a) => #2A((MOO MOO MOO) (MOO X MOO) (MOO MOO MOO))