Я изучаю Scheme и использую несколько примеров, чтобы увидеть, как это работает.
Я использую интерпретатор Chicken с 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)))) <--
Кто-нибудь знает, почему? Конечно, если я создам процедуру, которая говорит, что "show" будет отображать информацию, тогда она будет работать, но должна ли SHOW быть стандартной процедурой из Scheme? Потому что многие коды в Интернете показывают подобное, и нет описания процедуры «показа». То же самое происходит с READ/READ-LINE и т. д.
Спасибо!
display
вместоshow
? - person Anton Kovalenko   schedule 13.02.2013