Lisp 在方案上显示/读取/读取行/etc程序

Lisp 在方案上显示/读取/读取行/etc程序,lisp,scheme,procedure,Lisp,Scheme,Procedure,我正在学习这个计划,并用一些例子来说明它的工作原理 我正在使用Eclipse的鸡肉解释器 尝试运行以下代码时: (define (bottles n) (if (= n 0) 'burp (begin (verse n) (bottles (- n 1))))) (define (verse n) (show (cons n '(bottles of beer on the wall))) (show (cons n '(bottles o

我正在学习这个计划,并用一些例子来说明它的工作原理

我正在使用Eclipse的鸡肉解释器

尝试运行以下代码时:

(define (bottles n)
  (if (= n 0)
      'burp
      (begin (verse n)
         (bottles (- n 1)))))

(define (verse n)
  (show (cons n '(bottles of beer on the wall)))
  (show (cons n '(bottles of beer)))
  (show '(if one of those bottles should happen to fall))
  (show (cons (- n 1) '(bottles of beer on the wall)))
  (show '()))

(bottles 3)
我得到了以下错误:

#;1> #;2>  Note: the following toplevel variables are referenced but unbound:

  verse (in bottles)
#;3> #;3>  Note: the following toplevel variables are referenced but unbound:

  show (in verse)   show (in verse)   show (in verse)   show (in verse)   show (in verse)

Error: unbound variable: show

Call history:

<syntax>      (bottles 3)   <eval>    (bottles 3)   <eval>    [bottles] (= n 0)     <eval>    [bottles] (verse n)   <eval>    [verse] (show (cons n (quote (bottles of beer on the wall)))) <--
#;1> #;2> 注意:以下顶级变量被引用但未绑定:
诗句(在瓶子里)
#;3> #;3> 注意:以下顶级变量被引用但未绑定:
show(在诗中)show(在诗中)show(在诗中)show(在诗中)show(在诗中)
错误:未绑定变量:show
通话记录:

(瓶子3)(瓶子3)[瓶子](=n0)[瓶子](第n节)[诗句](show(cons n(引用(墙上的啤酒瓶)))没有定义
show
程序。作为在Chicken方案中实现的R5R的一部分,您可以使用
display
write
进行输出,如中所示

show
的功能很容易实现,不过:

(define (show obj)
  (display obj)
  (newline))

鸡的名字是
show
print
。 如果你这样做
(定义显示打印)

你可以使用任意一个名称

我并不真正喜欢口袋妖怪的方案,但它是
display
而不是
show
?不,我从这里得到了一个例子:那一章的一句话:“事实上,show并不是一个正式的方案原语;我们是根据display和newline编写的。”什么是最完整的方案解释器?@user1060551这是一个非常非常主观的问题,取决于你对“complete”的理解。出于学习的目的,我喜欢DrRacket。