title: Newton's square root method in Scheme or Common Lisp
body: <p>I am not able to figure out the error in this program. This is the Scheme version. I tried Common Lisp version as well. In both cases, the program keeps running without any result. Please help.</p>
  
  <pre><code>(define (sqrt1 x)
  
    (define (square x)
        (* x x))
  
    (define (isGoodEnough g x)
        (&lt; (abs (- (square g) (square x))) 0.01))
  
    (define (average x y)
        (/ (+ x y) 2))
  
    (define (improvedGuess g x)
        (average g (/ x g)))
  
    (define (sqrt-iter g x)
        (if (isGoodEnough g x)
            g
            (sqrt-iter (improvedGuess g x) x)))
  
    (sqrt-iter 1.0 x))
  </code></pre>