scheme - Little Schemer atom vs (quote atom)

标签 scheme lisp

我刚刚开始阅读小阴谋家。它从几个问题开始,询问给定的表达式是否是一个原子。这很简单,但有趣的是,第一个问题让我有点反感。它问:

Is it true that this is an atom?
  atom1

1 (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/

相关文章:

lisp - 关于两个函数的堆栈溢出

c++ - 为什么在 Lisp 中计算 1000 阶乘的速度如此之快(并显示正确的结果)?

algorithm - 方案中的算法或数据结构书籍

scheme - Racket Scheme 是否提供类似 Smalltalk 的基于图像的环境?

lisp - SICP中的一个例子

scheme - 检测 Scheme 或 Racket 中函数的调用者

scheme - 如何在 Scheme 中重写 "begin"?

emacs - 如何编辑 quicklisp 的系统定义文件

installation - 如何在 Debian 上安装/升级 Lisp 库

javascript - 持久数据结构 : a persistent index?