# 2.4.6 点对类型

点对是 Lisp 中最基础，最常用的容器对象。它包含两个槽(slot)，CAR 槽和 CDR 槽。其中每个槽都可以储存任何 Lisp 对象。通常我们提到点对的CAR时，我们是在说这个点对 CAR 槽所储存的对象。 CDR 同理。

我们熟知的 列表 就是有一系列的点对嵌套组成的，其中每个点对的 CDR 槽都储存着下一个 点对，而最后一个点对的 CDR 槽储存着 nil。点对是构成 Lisp 列表的最基础的组件，我们称任何由点对构成的结构都统称为列表结构。

给 C 程序员的提示：Lisp 列表看起来就像由点对单元组成的链表。在 Lisp 中，指针都是隐式使用的，因此我们不会对 储存值的槽 和 指向数值的指针 进行区分。

点对是 Lisp 的**核心数据结构**。所有不是点对的对象统称为原子。

列表的读取语法和打印表示是相同的。一个列表的读取语法（或打印表示）：一个左括号，任意数量的元素，以及一个右括号。这里有几个例子：

```
(A 2 "A")            ; 包含 3 个元素的列表.
()                   ; 不包含任何元素的列表.
nil                  ; 同上 (空列表).
("A ()")             ; 包含 1 个元素的列表: 这个元素是字符串： "A ()".
(A ())               ; 包含 2 个元素的列表: A 以及一个空列表.
(A nil)              ; 同上.
((A B C))            ; 包含 1 个元素的列表
                     ;   (这个元素是一个包含 3 个元素的列表).
```

以上列表中，括号内的对象都是该列表的元素。也就是说，每个元素都占着一个点对槽。点对的 CAR 槽储存元素，而 CDR 槽则指向列表中的下一个点对，而下一个点对储存着下一个元素。最后的点对的 CDR 槽则指向 nil。

CAR 和 CDR 听上去很怪，这是 Lisp 的历史遗留问题，不要多想。


---

# 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.6-dian-dui-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.
