Next: , Previous: , Up: Sequences   [Contents][Index]


5.5.5 Array Functions

Function: arrayp object

This function returns true if object is an array.

Function: aref array position

Returns the element of the array (vector or string) array position elements from the first element (i.e. the first element is numbered zero). If no element exists at position in array, false is returned.

(aref [0 1 2 3] 2)
    ⇒ 2

(aref "abcdef" 3)
    ⇒ 100                      ;`d'
Function: aset array position value

This function sets the element of the array array with an index of position (counting from zero) to value. An error is signalled if element position does not exist. The result of the function is value.

(setq x [0 1 2 3])
    ⇒ [0 1 2 3]
(aset x 2 'foo)
    ⇒ foo
x
    ⇒ [0 1 foo 3]