僕の解答
こんな感じかな…
(define (improve guess x) (/ (+ (/ x (* guess guess)) (* 2 guess)) 3)) (define (good-enough? x guess) (< (abs (- (* guess guess guess) x)) 0.001)) (define (cubic-iter guess x) (if (good-enough? x guess) guess (cubic-iter (improve guess x) x))) (define (cubic x) (cubic-iter 1.0 x)) (display (cubic 8)) (newline)
解答例
所感
good-enough?は改良版を使ってるなぁ。