[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lexical scoping--Please help



Hi all,
I have the following program, it computes a solution for the equation
(x=2*sinx) by doing a set of iterations and estimating a "guess" an
improving it.
My problem is that I want to display for each iteration the value of
"guess".
I have to use the procedure "diplay (guess)" but I couldn't find the place
where to put this display function---------please help

(define (x=2*sinx)
  (define (good-enough? guess)
    (< (abs (- guess (* 2 (sin guess)))) 0.001))
  (define (improve guess)
    (* 2 (sin guess)))
  (define (iter guess)
    (if (good-enough? guess)
        guess
        (iter (improve guess))))
  (iter 1))