| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In this section, we describe the functions that accept all types of arrays.
t if object is an array (i.e., a
vector, a string, a bool-vector or a char-table).
(arrayp [a])
=> t
(arrayp "asdf")
=> t
(arrayp (syntax-table)) ;; A char-table.
=> t
|
(setq primes [2 3 5 7 11 13])
=> [2 3 5 7 11 13]
(aref primes 4)
=> 11
(aref "abcdefg" 1)
=> 98 ; `b' is ASCII code 98.
|
See also the function elt, in 6.1 Sequences.
(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)
=> 90
x
=> "asdZasfd"
|
If array is a string and object is not a character, a
wrong-type-argument error results. The function converts a
unibyte string to multibyte if necessary to insert a character.
(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 ?-)
=> "------------------"
|
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 section 6.1 Sequences.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |