common-lisp - 为什么运球会产生一个空文件?
问题描述
我正在尝试通过Common Lisp:符号计算的简单介绍一书来学习 Common Lisp 。此外,我正在使用 SBCL、Emacs 和 Slime。
在第 9 章的最后,作者展示了运球工具。他展示了以下内容:
我试图重现作者提出的命令。考虑到输入,唯一的区别是我放置了不同的位置来保存文件。在我的环境中,我做了:
CL-USER> (dribble "/home/pedro/miscellaneous/misc/symbolic-computation/teste-tool.log")
; No value
CL-USER> (cons 2 nil)
(2)
CL-USER> '(is driblle really working?)
(IS DRIBLLE REALLY WORKING?)
CL-USER> "is dribble useful at all?"
"is dribble useful at all?"
CL-USER> (dribble)
; No value
该文件确实已创建:
$ readlink -f teste-tool.log
/home/pedro/miscellaneous/misc/symbolic-computation/teste-tool.log
请注意,我在输入时没有在 REPL 中收到诸如“现在在文件中记录 --location ---”之类的消息。但这可能会根据 Lisp 实现而有所不同。
令人惊讶的是,不幸的是,该文件是空的。因此,运球没有按预期工作。
我做错什么了吗?
解决方案
是的,默认情况下,在 Slime 中,我认为这不起作用。
它将在 SBCL Repl 中工作:
➜ sbcl
This is SBCL 2.0.1.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (dribble "dribble-test.lisp")
* (* 8 5)
40
* "Will this work?"
"Will this work?"
* (dribble)
* %
可以确认的:
➜ cat dribble-test.lisp
* (* 8 5)
40
* "Will this work?"
"Will this work?"
* (dribble)
使用 Slime IMO 保存“REPL 历史”似乎不太有用,因为您通过选择一个函数或表达式或区域并在 REPL 中对其进行评估来执行所有“非 REPL 评估”。
要在 Slime 中实际保存和查看历史记录,请参阅
slime-repl-save-history
和相关功能;如果您愿意,您甚至可以合并来自独立Repls的历史:-)
推荐阅读
- javascript - 如何修复未定义的不是对象(评估'firebase.apps.length')
- angular - 部署和托管 Laravel Rest api 以及 Angular App 和 mysql DB
- reactjs - 蚂蚁设计怎么了?从 GitHub 中删除
- firebase - 如何在flutter firebase中进行全文搜索
- html - Bootstrap justify-content 不适用于表单
- reactjs - I cant get formik to import properly
- c - 无法从常驻 .c 文件访问的不透明指针
- javascript - node.js - 无法弄清楚为什么它不等待承诺
- material-design - 夜间模式下的 ExposedDropdownMenu 显示不正确的文本颜色
- sql-server - 将表上的 NULL 转换为空白