Уча 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 да бъде стандартна процедура от Scheme? Тъй като много кодове в интернет показват така и няма описание на процедурата за „показване“. Същото се случва с READ/READ-LINE и т.н.
Благодаря!
display
вместоshow
? - person Anton Kovalenko   schedule 13.02.2013