# 2.4.5 序列类型

序列是 Lisp 中的有序容器。 在 Lisp 中有两种序列：列表和数组。

列表是最常用的序列。列表可以容纳任何类型的元素，并且可以很轻松的增减元素。详情查阅接下来的小节。

和列表不同，数组是定长的序列。数组还可以分为字符串，向量，字符表以及布尔向量四种类型。向量也可以容纳任何类型的元素，但字符串的元素就只能是字符，类似的，布尔向量的元素只能是 t 和 nil 这样的布尔值。字符表比较像向量，不过字符表是使用字符进行索引的。此外，字符串中的字符可以拥有自己的字符属性，这和缓冲区中的文本类似。相比之下，向量不支持文本属性，即便其元素为字符。

列表，字符串，以及其他数组类型都很相似。比如，它们都有长度，都是从 0 开始索引，到-1结束索引的。序列函数，可以作用在这几种类型上。举个例子，函数 length 可以返回任何序列类型对象的长度。

通常来说，读取器不可能两次读取到相同的序列，因为每次读取的时候，都会即时生成一个新序列。如果你读取同一个序列的读取语法两次，那么你会得到两个内容相同，但对象不同的序列。不过有个例外，空列表 () 总是表示同一个对象，也就是nil。


---

# 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/lisp-shu-ju-lei-xing/bian-cheng-lei-xing/2.4.5-xu-lie-lei-xing.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.
