小Schemer原子vs(引用原子) [英] Little Schemer atom vs (quote atom)

查看:55
本文介绍了小Schemer原子vs(引用原子)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始阅读小计划者.它从几个问题开始,询问一个给定的表达式是否是一个原子.这很简单,但有趣的是,第一个问题让我有些不安.它要求:

I've just started reading The Little Schemer. It starts off with several questions asking if a given expression is an atom. It's pretty straightforward but, funny enough, the very first question is throwing me off a bit. It asks:

这真的是原子吗?
原子 1

1 (引用原子)’atom

让我烦恼的是脚注参考.他们问 atom 是一个原子,但是然后又以某种方式说 atom (引用原子)'原子?我就是不明白.

What's throwing me off is the footnote reference. They're asking if atom is an atom, but then somehow they're saying that atom is really (quote atom) or ’atom? I just don't get it.

推荐答案

这里发生的是Friedman试图避免使读者立即陷入报价阅读器宏的技术难题,因此他提供了一些非常简单的示例,但当按原样输入REPL时,这实际上不起作用.在某些时候,有人认为他们应该提供有效的代码,但他们不想浪费原始文本,因此他们将代码添加为脚注.

What’s going on here is Friedman was trying to avoid bogging the reader down with technicalities of the quote reader macro right away, so he provided examples that were very simple but which didn’t actually work when typed as-is into a REPL. At some point somebody thought they should provide working code, but they didn’t want to junk up the original text, so they added the code as a footnote.

序言中说:

此外,您可能需要稍微修改程序.通常,该材料仅需要少量更改.框架注释中提供了有关如何尝试本书中程序的建议.带有"S:"关注方案的框架注释,带有"L:"关注的框架注释涉及Common Lisp.

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仅表示不属于列表的任何内容.在练习过程中,您将需要测试列表中的一个元素,以查看它是否为另一个列表.他们正在为非清单事物引入一个术语.

Atom just means anything that isn’t a list. As you work through the exercises you’ll need to be able to test an element of a list to see if it is another list. They’re introducing a term for a non-list thing.

另外请注意,报价是由读者处理的,读取和评估表达式的过程会消耗报价,所以:

Also be aware quoting is handled by the reader, the process of reading and evaluating the expression consumes the quote, so:

(quote atom) 

评估为

atom

这篇关于小Schemer原子vs(引用原子)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆