Code Review
Compare your solutions
#| BEGIN (Введите свое решение) |#
(define (square x) (* x x))
(define (sqrt-iter guess x)
(if
(good-enough? guess x) guess
(sqrt-iter (improve guess x) x)
)
)
(define (improve guess x)
(average guess (/ x guess))
)
(define (average a b) (/ (+ a b) 2))
(define (good-enough? guess x)
(< (abs (- (square guess) x))
0.0001)
)
(define (square-root x) (sqrt-iter 1.0 x))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (square x) (* x x))
(define (sqrt-iter guess x)
(if
(good-enough? guess x) guess
(sqrt-iter (improve guess x) x)
)
)
(define (improve guess x)
(average guess (/ x guess))
)
(define (average a b) (/ (+ a b) 2))
(define (good-enough? guess x)
(< (abs (- (square guess) x))
0.0001)
)
(define (square-root x) (sqrt-iter 1.0 x))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (square x) (* x x))
(define (sqrt-iter guess x)
(if
(good-enough? guess x) guess
(sqrt-iter (improve guess x) x)
)
)
(define (improve guess x)
(average guess (/ x guess))
)
(define (average a b) (/ (+ a b) 2))
(define (good-enough? guess x)
(< (abs (- (square guess) x))
0.0001)
)
(define (square-root x) (sqrt-iter 1.0 x))
#| END |#
#| BEGIN (Введите свое решение) |#
(define (square x) (* x x))
(define (sqrt-iter guess x)
(if
(good-enough? guess x) guess
(sqrt-iter (improve guess x) x)
)
)
(define (improve guess x)
(average guess (/ x guess))
)
(define (average a b) (/ (+ a b) 2))
(define (good-enough? guess x)
(< (abs (- (square guess) x))
0.0001)
)
(define (square-root x) (sqrt-iter 1.0 x))
#| END |#