1
내가 SICP을 읽고 있어요에 "카운트 변화를"코드를 실행라도하게하고, 장에서 한 아래와 같은 코드를 언급 :는 SICP
#lang scheme
(define (count-change amount)
(cc amount 5))
(define (cc amount kind-of-coins)
(cond ((= amount 0) 1)
((or (< amount 0) (= kind-of-coins 0)) 0)
(else (+ (cc amount
(- kind-of-coins 1))
(cc (- amount
(first-denomination kind-of-coins))
kind-of-coins)))))
(define (first-denomination kinds-of-icons)
(cond ((= kinds-of-icons) 1)
((= kinds-of-icons) 5)
((= kinds-of-icons) 10)
((= kinds-of-icons) 25)
((= kinds-of-icons) 50)))
(count-change 100)
내가 DrRacket에 코드를 입력
,하지만 난 실행할 수 없습니다 그것은 성공적으로, 나는 ont 시간 동안 시도되었습니다, 무엇이 잘못되었는지를 모릅니다.
Thnaks 대단히! 조용한 어리석은 실수 ... TT – scriptboy