当前位置: 代码迷 >> 其他开发语言 >> PLTscheme报错看不懂,该怎么解决
  详细解决方案

PLTscheme报错看不懂,该怎么解决

热度:2840   发布时间:2013-02-26 00:00:00.0
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 没法嵌套的吧
  相关解决方案