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

lexical scoping--Please help

This page is part of the web mail archives of SRFI 15 from before July 7th, 2015. The new archives for SRFI 15 contain all messages, not just those from before July 7th, 2015.

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
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)
        (iter (improve guess))))
  (iter 1))