7.1 记录相关函数

Function: recordp object

该函数会在 object 是记录(record)类型时返回 t

(recordp #s(a))
     ⇒ t
Function: record type &rest objects

该函数用于创建并返回一个记录(record),其类型由参数 type 指定,剩余的槽位(slot)则由其余参数 objects 填充。

(record 'foo 23 [bar baz] "rats")
     ⇒ #s(foo 23 [bar baz] "rats")
Function: make-record type length object

该函数返回一个新的记录(record),其类型为 type,并包含 length 个额外的槽位(slot),且每个槽位都会初始化为 object

(setq sleepy (make-record 'foo 9 'Z))
     ⇒ #s(foo Z Z Z Z Z Z Z Z Z)

要复制由记录、向量和 cons 单元(列表)构成的树形结构,请使用 copy-tree 并将其可选的第二个参数设为非 nil。See copy-tree

emacs

Emacs

org-mode

Orgmode

Donations

打赏

Copyright

© 2025 Jasper Hsu

Creative Commons

Creative Commons

Attribute

Attribute

Noncommercial

Noncommercial

Share Alike

Share Alike