所以我最近一直在努力学习Lisp。不幸的是,似乎没有任何效果 - 我正在关注 this Common Lisp tutorial但是当我第二次尝试运行 (hello-world)
时,它没有做同样的事情,而是给了我一个错误(我输了,因为我没想到要保存它)关于如何CL-USER>
是一个 undefined variable 。我从未在 SLIME 中输入过 CL-USER>
,但这就是提示符。我重新启动了 EMACS 和 SLIME(即关闭了窗口)并重新启动了它。但是,在尝试使用 (load "name")
方法时,它给了我以下错误:
Compiler warnings for "helloworld.cl" :
; In an anonymous lambda form at position 43: Undeclared free variable CL-USER>
; In an anonymous lambda form at position 52: Undeclared free variable CL-USER>
; In an anonymous lambda form at position 58: Undeclared free variable ..\sOURCECODELISP\hELLOWORLD.CL
; In an anonymous lambda form at position 161: Undeclared free variable CL-USER>
; In an anonymous lambda form at position 278: Undeclared free variable CL-USER>
; In an anonymous lambda form at position 389: Undeclared free variable CL-USER>
Read error between positions 441 and 450 in f:/Lispbox/helloworld.cl.; Evaluation aborted on #<SIMPLE-ERROR #x2100B925AD>.
我该如何解决?
编辑:关闭它后,去我接下来的几节课,然后放学后留下来,问题仍然存在,但现在它只是提示 CL-USER>
不是定义的变量。
仅供引用,我最初尝试从 ..\sourcecode\Lisp\helloworld.cl
加载我的文件,因为那是我最初放置它的地方。我忘记了它周围的引号,所以这可能导致了问题。
最佳答案
当您将代码从交互式 session 复制到文件 helloworld.cl
时,您应该已经删除了提示和交互消息。
关于emacs - 为什么 SLIME 会抛出这些错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21141347/