PLTscheme报错看不懂
源代码
(define (square x) (* x x))
(define (average x y)
(/ (+ x y) 2))
(define (sqrt x)
(define (good-enough? guess)
(< (/ (abs (- (square guess) x)) x) 0.001))
(define (improve guess)
(average guess (/ x guess)))
(define (sqrt-iter guess)
(if (good-enough? guess)
guess
(sqrt-iter (imporve guess))))
(sqrt-iter 1.0))
然后define: expected only one expression for the function body, but found at least one extra part
没明白哪里错了
[解决办法]
其实很好懂,define 没法嵌套的吧