首页 > 代码库 > SICP习题练习

SICP习题练习

练习1.6

new-if的三个参数会先被执行,这样就会无限循环下去

练习1.7

 

(define (sqrt-iter last-guess guess x)  (if (good-enough? last-guess guess)    guess    (sqrt-iter guess (improve guess x) x))

 

 

另一种解法:

(define (good-enough? guess x)   (< (/ (abs (- (square guess) x)) guess) (* guess 0.0001))) 

 

SICP习题练习