我刚刚开始阅读小阴谋家。它从几个问题开始,询问给定的表达式是否是一个原子。这很简单,但有趣的是,第一个问题让我有点反感。它问:
Is it true that this is an atom?
atom11 (quote atom) or ’atom
让我失望的是脚注引用。他们问 atom 是不是原子,但不知何故他们说 atom 真的是 (quote atom) 或 '原子?我就是不明白。
最佳答案
这里发生的事情是 Friedman 试图避免立即让读者因引用阅读器宏的技术细节而陷入困境,因此他提供了非常简单但在按原样输入 REPL 时实际上不起作用的示例.在某些时候,有人认为他们应该提供工作代码,但他们不想破坏原始文本,所以他们将代码添加为脚注。
前言说:
Moreover, you may need to modify the programs slightly. Typically, the material requires only a few changes. Suggestions about how to try the programs in the book are provided in the framenotes. Framenotes preceded by "S:" concern Scheme, those by "L:" concern Common Lisp.
Atom 指任何不是列表的东西。在完成练习时,您需要能够测试列表的元素以查看它是否是另一个列表。他们正在为非列表事物引入一个术语。
还要注意引用是由读者处理的,读取和评估表达式的过程会消耗引用,所以:
(quote atom)
评估为
atom
关于scheme - Little Schemer atom vs (quote atom),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53798845/