我正在阅读 SICP 并尝试跟进,但为什么我在网上找到的 Lisp 解释器在使用 DEFINE 关键字时会失败?

发布于 2024-12-21 02:44:50 字数 925 浏览 2 评论 0原文

这是书...

http://mitpress.mit.edu/ sicp/full-text/book/book.html

知道我应该使用哪种解释器来处理此处提供的代码吗?

到目前为止,我已经尝试了一些在线并下载 Lisp 解释器,当我尝试使用 DEFINE 时,我得到的只是错误。

示例:

从此部分中: http: //mitpress.mit.edu/sicp/full-text/book/book-ZH-10.html#%_sec_1.1

在此输入:http://www.ugcs.caltech.edu/~rona/tlisp/

> (define (square x) (* x x))
*** EVAL Error: Function 'DEFINE' is not defined. ***

也尝试过与 'lispbox' 具有类似的结果。

啊哈: http://sisc-scheme.org/sisc-online.php 有效,感谢blabla999的提示,很快就会接受答案。

经过进一步研究:Scheme != Common Lisp

This is the book...

http://mitpress.mit.edu/sicp/full-text/book/book.html

Any idea which interpreter I should use to work with the code presented here?

So far I have tried a few online and download Lisp interpreters and all I get is errors when I try to use DEFINE.

Example:

From this section: http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-10.html#%_sec_1.1

Put in here: http://www.ugcs.caltech.edu/~rona/tlisp/

> (define (square x) (* x x))
*** EVAL Error: Function 'DEFINE' is not defined. ***

Also tried with 'lispbox' with similar results.

Ah HA: http://sisc-scheme.org/sisc-online.php works, thanks for the tip blabla999, will accept answer soon.

Upon further research: Scheme != Common Lisp

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不忘初心 2024-12-28 02:44:50

可能是因为:

(EQ方案CommonLisp)-> #f

以及:

(EQ 方案 ManyOtherLisps) -> #f

尝试一个真正的方案(我推荐 plt,最近已更名为 Racket)。
(或者编写您自己的 - 请参阅 http://www.avc-cvut.cz/ avc.php?id=9769)

probably because:

(EQ Scheme CommonLisp) -> #f

and also:

(EQ Scheme ManyOtherLisps) -> #f

try a real scheme (I recommand plt, which has been renamed to Racket, recently).
(Or write your own - see http://www.avc-cvut.cz/avc.php?id=9769)

丑疤怪 2024-12-28 02:44:50

Lisp 有很多不同的方言,其中 Common Lisp 可能是当今最常用的。您所熟悉的Scheme 并不声称自己是Lisp,尽管它具有许多共同特征。

无论如何,您正在尝试做的事情是

(defun square (x) (* x x))

用 Common Lisp 编写的。

There is a great many different dialects of Lisp, of which Common Lisp is perhaps the most used today. Scheme, with which you are familiar, does not claim to be a Lisp, although it shares many characteristics.

For what it's worth, what you are trying to do is written

(defun square (x) (* x x))

in Common Lisp.

穿越时光隧道 2024-12-28 02:44:50

(到目前为止)我发现为 SCIP 中的示例获取 Lisp 环境的最简单方法是在此处找到的 Racket 中使用 DrRacket http://racket-lang.org/

DrRacket 环境有一个编辑器和 REPL,支持复制/粘贴和漂亮的打印,就像 Python Idle 工具一样。它安装简单,可与书中的所有示例一起使用,视频

我在这里发现了关于学习 Lisp 的其他重要提示:http://www.lisp. Learningclojure.com/2011/02/advice-to-newbie.html

The simplest way (by far) I have found to get a Lisp environment for the examples in SCIP is to use DrRacket in Racket found here http://racket-lang.org/

The DrRacket environment has an editor and REPL that supports copy/paste and pretty print much like the Python Idle tool. It is simple to install and works with all of the examples from the book and the videos.

I found this other great hints on learning lisp here: http://www.learningclojure.com/2011/02/advice-to-newbie.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文