为什么在这个宏定义中需要@符号?

Luk*_*uke 8 lisp macros

在下面的宏时:

(defmacro when (condition &rest body)
  `(if ,condition (progn ,@body)))
Run Code Online (Sandbox Code Playgroud)

为什么那里有一个标志?

650*_*502 18

通过一个小实验很容易看出差异

> (let ((x '(1 2 3 4))) `(this is an example ,x of expansion))
(THIS IS AN EXAMPLE (1 2 3 4) OF EXPANSION)

> (let ((x '(1 2 3 4))) `(this is an example ,@x of expansion))
(THIS IS AN EXAMPLE 1 2 3 4 OF EXPANSION)
Run Code Online (Sandbox Code Playgroud)

正如您所看到的那样,使用,@会将列表的元素直接放在扩展中.没有你得到放在扩展中的列表.