Code Review

Compare your solutions

    #| BEGIN (Введите свое решение) |#
(define (iterative-improve good-enough? improve-method)
  (define (iter guess y)
      (if (good-enough? guess y)
       guess
       (iter (improve-method guess) (improve-method y))  
      )
  )
  (lambda (x)
    (iter x (improve-method x))
  )  
)

(define dx 0.00001)

(define (average x y)
  (/ (+ x y) 2))

(define (sqrt x)
    (define (close-enough? x1 x2)
      (< (abs (- x1 x2)) dx))
  (define (improve guess)
      (average guess (/ x guess)))
    ((iterative-improve close-enough? improve) 1.0)
)

(define (fixed-point f first-guess)
    (define (close-enough? x1 x2)
      (< (abs (- x1 x2)) dx))
  ((iterative-improve close-enough? f) first-guess)
)
#| END |#