I'm trying to study SICP. I use Dr.Racket and intall Neil Van Dyke's SICP Support for DrRacket. When I practice examples of the book, I bumped into something confused me.
The following codes are from the book and I use the procedure "sqrt" at beginning:
Code: Select all
(sqrt (+ 100 37))
(define (sqrt-iter guess x)
(if (good-enougth? guess x)
guess
(sqrt-iter (improve guess x)
x)))
(define (improve guess x)
(average guess (/ x guess)))
(define (average x y)
(/ (+ x y) 2))
(define (good-enougth? guess x)
(< (abs (- (square guess) x)) 0.001))
(define (square x)
(* x x))
(define (sqrt x)
(sqrt-iter 1.0 x))
And I do an experiment:
Code: Select all
(add 2 2)
(define (add x y)
(test x y))
(define (test x y)
(+ x y))
Thank you