This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
语法 | |
(optimize {quality | (quality value)}*) | |
参数和值 | |
quality --- 一个优化种类 | |
value --- 一个整数, 取值范围为0,1,2,3中的一个 | |
上下文 | |
declaration 或者 proclamation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
局部变量: | |
当 loop 的 form 执行时, 局部变量被绑定和被初始化. | |
这些局部变量会一直存在直到 loop 结束. | |
可以用 with 来顺序初始化变量. 可以用 and 来并行绑定 | |
代码 | |
* (loop with a = 1 | |
with b = (+ a 2) | |
with c = (+ b 3) | |
return (list a b c)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
形式 | |
(item1 item2 . tail) | |
描述 | |
tail 代表 list 最后的一串 object | |
代码 | |
* '(A B C . (D E F)) | |
(A B C D E F) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
描述 | |
在 common lisp 中经常可以看到NIL, NIL 有两个含义 | |
1. boolean 中的 false | |
2. 空列表 | |
第一种含义在其他语言中(比如 python 是比较符合行为习惯的), 但第二种就少见, | |
在其他语言中, 一般如果为空列表, 对空列表求值可能为 nil, 而不是 nil 表示空列表 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
语法 | |
defparameter name initial-value [documentation] => name | |
defvar name [initial-value [documentation]] => name | |
参数和值 | |
name --- 一个 symbol, 不会被求值 | |
initial-value --- 一个 form, 如果在 defparameter 中, 会被求值. 如果在 defvar 中,只有在 name 没有被绑定的时候被求值. | |
documentation --- 一个 string, 不会被求值 | |
描述 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
语法 | |
every predicate &rest sequences+ => generalized-boolean | |
some predicate &rest sequences+ => result | |
notevery predicate &rest sequences+ => generalized-boolean | |
notany predicate &rest sequences+ => generalized-boolean | |
参数和值 | |
predicate --- 一个函数指示符, 这个函数要接受的参数个数和 sequences 数目一样多 | |
sequence --- 一个 sequence | |
result --- 一个 object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
语法 | |
when test-form form* => result* | |
unless test-form form* => result* | |
参数和值 | |
test-form --- 一个 form | |
forms --- 一个隐式的 progn | |
results --- when 表达式中,当 test-form 为 true 时, 为 form的值. 在 unless 中, test-form 为 false 时, 为 form的值 | |
否则为 nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
语法 | |
nth-value n form => object | |
参数和值 | |
n --- 一个非负整数 | |
form --- 一个 form | |
object --- 一个 object | |
描述 | |
nth-value 首先对 n 求值, 然后对 form 求值. 返回 form 的第 n 个值。如果 n 大于等于 form 的值的个数, 则返回 nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
语法 | |
typecase keyform {normal-clause}* [otherwise-clause] => result* | |
参数和值 | |
keyform --- 一个 form, 会被求值去产生一个 test-key | |
描述 | |
待补充 | |
代码 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
语法 | |
write-byte byte stream => byte | |
参数和值 | |
byte --- 一个正整数, | |
stream --- 一个二进制的 stream | |
描述 | |
write-byte 往 stream 里写入一个字符 byte |