sequence | a sequence |
index | valid sequence index |
ELT function accesses specified elements of sequences. The index is counted from zero. Accessing out-of-bounds indices signals condition, or causes crash and/or undefined behavior, depending on compilation safety mode. Unlike AREF, ELT works on lists too.
ELT may by used with conjunction of SETF.
(elt "hola" 0) => #\h (elt "hola" 3) => #\a (elt #(5 3 6 8) 1) => 3 (elt '(5 3 6 8) 1) => 3
(let ((a (list 1 2 3 4))) (setf (elt a 1) 'x) a) => (1 X 3 4) (let ((a (copy-seq "hola"))) (setf (elt a 1) #\O) a) => "hOla"