我今天在scheme中写了以下代码,但是评估错误。请不要告诉我我编程很烂,我知道这是一个经典的递归问题,但我遇到了麻烦:
(define (towers-of-hanoi n source temp dest)
(if (= n 1)
(begin (display "Move the disk from ")
(display source)
(display " to " )
(display dest)
(newline))
(begin (towers-of-hanoi (- n 1) source temp dest)
(display "Move the disk from ")
(display source)
(display " to ")
(display dest)
(newline)
(towers-of-hanoi(- n 1) temp source dest))))
我希望代码能够工作,但当我调试它时,我只会让自己更加困惑。谁能帮我?