@ Pohon BBS

SICP : Let's Read!

Go back: thread mode | tree mode | sub tree

#19. Excercise 1.7
Published: 2026-09-14 [Mon] 01:50, by PhatCat
The full code is VERY long and has multiple things needing to be defined so ill only post what was changed from the procedure defined in SICP. My thought process was:
need to compare guesses, so need to know guess-1 and guess-2
modify the improve definition to "save" the old guess? (oh no...)
OR
just use (improve guess x) itself as the guess 2

then
;modified from 1.1.7 for Exercise 1.7
(define (good-enough? guess x)
;(< (abs (- (square guess) x)) 0.001));old/original code [from SICP]
(< ;check if guess is within tolerance
(abs ; stops it from breaking if it gives a negative number
(- ;small difference between subsequent guesses => fraction ~1, so fraction-1 ~0
(/
(abs (square guess))
(abs (square (improve guess x)))) 1)) 0.001))
...
(sqrt 0.00000000000001) ;very small number test
(sqrt 1000000000000000) ;very large number test

answers were correct
.

New Reply



(new)

You need to solve the captcha before you can post.


Parents

#4. Chapter 1
Published: 2026-09-08 [Tue] 19:21, by Anonymous
SICP chapter 1
> Building Abstractions with Procedures

https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/full-text/book/book-Z-H-9.html#%_chap_1
.

#1. SICP : Let's Read!
Published: 2026-09-08 [Tue] 19:18, by piper
> SICP Book:
https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/full-text/book/book-Z-H-4.html

> SICP Lectures:
https://www.youtube.com/playlist?list=PLE18841CABEA24090
> Racket Scheme
https://racket-lang.org/download/
> SICP Racket
https://docs.racket-lang.org/sicp-manual/Installation.html

Let's embrace the tree structure of Pohon BBS.

Top level comments for chapters of the book,
replies to top level comments for discussions of the chapter.

Comment #2 will be for general help installing Scheme
Comment #3 will be for random Scheme discussion that doesn't
fit into chapter discussion.

Ready, start, go!
.
Pohon BBS