# 6.3 数组相关函数

本章将会介绍几个操作数组的函数，这些函数可以用在所有的数组类型上。

Function: arrayp object\
&#x20; 当 object 为数组时，该函数返回 t 。（数组包括向量、字符串、布尔向量以及字符表）

```
(arrayp [a])
    => t
(arrayp "asdf")
    => t
(arrayp (syntax-table))    ;; 字符表
    => t
```

Function: aref arr index\
&#x20; 这个函数返回 数组的第 index 个元素。其中，第一个元素对应的索引为0.

```
(setq primes [2 3 5 7 11 13])
    => [2 3 5 7 11 13]
(aref primes 4)
    => 11
(aref "abcdefg" 1)
    => 98         ; "b" 的ASCII码是98
```

类似的函数有 elt，不过是作用在序列上的，查阅序列章节。

Function: aset array index object\
TODO


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://emacs-lisp.ivory.cafe/xu-lie-shu-zu-he-xiang-liang/shu-zu-han-shu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
