Next: Vectors, Previous: Arrays, Up: Sequences Arrays Vectors [Contents][Index]
In this section, we describe the functions that accept strings, vectors, and bit vectors.
This function returns t
if object is an array (i.e., a
string, vector, or bit vector).
(arrayp "asdf") ⇒ t (arrayp [a]) ⇒ t (arrayp #*101) ⇒ t
This function returns the indexth element of array. The first element is at index zero.
(setq primes [2 3 5 7 11 13]) ⇒ [2 3 5 7 11 13] (aref primes 4) ⇒ 11 (elt primes 4) ⇒ 11
(aref "abcdefg" 1) ⇒ ?b
(aref #*1101 2) ⇒ 0
See also the function elt
, in Sequence Functions.
This function sets the indexth element of array to be object. It returns object.
(setq w [foo bar baz]) ⇒ [foo bar baz] (aset w 0 'fu) ⇒ fu w ⇒ [fu bar baz]
(setq x "asdfasfd") ⇒ "asdfasfd" (aset x 3 ?Z) ⇒ ?Z x ⇒ "asdZasfd"
(setq bv #*1111) ⇒ #*1111 (aset bv 2 0) ⇒ 0 bv ⇒ #*1101
If array is a string and object is not a character, a
wrong-type-argument
error results.
This function fills the array array with object, so that each element of array is object. It returns array.
(setq a [a b c d e f g]) ⇒ [a b c d e f g] (fillarray a 0) ⇒ [0 0 0 0 0 0 0] a ⇒ [0 0 0 0 0 0 0]
(setq s "When in the course") ⇒ "When in the course" (fillarray s ?-) ⇒ "------------------"
(setq bv #*1101) ⇒ #*1101 (fillarray bv 0) ⇒ #*0000
If array is a string and object is not a character, a
wrong-type-argument
error results.
The general sequence functions copy-sequence
and length
are often useful for objects known to be arrays. See Sequence Functions.
Next: Vectors, Previous: Arrays, Up: Sequences Arrays Vectors [Contents][Index]