Last active
December 3, 2016 10:34
-
-
Save zhouqiang-cl/32da46040bb30cfbca1c0a8d1910222c to your computer and use it in GitHub Desktop.
common lisp 的宏 PUSH 和 POP
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
语法 | |
push item place => new-place-value | |
pop place => element | |
参数和值 | |
item --- 一个 object | |
place --- 一个 place 对象 | |
new-place-value --- 一个 list | |
描述 | |
push 将 item 压入存储在 place 的 list 中, 把结果 list 存储在 place,并返回结果 list | |
pop 和 push 功能相反 | |
代码 | |
* (setq x '(a (b c) d)) | |
(A (B C) D) | |
* (push 5 (cadr x)) | |
(5 B C) | |
* x | |
(A (5 B C) D) | |
* (pop (cadr x)) | |
5 | |
* x | |
(A (B C) D) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment