[racket] Error in HtDP Fig 75
Thanks for the bug report.
It turns out that someone had reported the mistake before, but for some reason, the revised typo list didn't make it to the web site (http://www.htdp.org/2003-09-26/typos.html).
-- Matthias
On Mar 29, 2013, at 3:38 PM, Michael Situ wrote:
> I just wanted to point this error out. Although the proper block of code is presented on page 329, that block of code is not incorporated in Fig 75. Additionally, the call to "find-root" is missing "f"
>
> ;; find-root : (number -> number) number number -> number
> ;; to determine a number R such that f has a
> ;; root between R and (+ R TOLERANCE)
> ;;
> ;; ASSUMPTION: f is continuous and monotonic
> (define (find-root f left right)
> (cond
> [(<= (- right left) TOLERANCE) left]
> [else
> (local ((define mid (/ (+ left right) 2)))
> (cond
> [(or (<= (f mid) 0 (f right)) (<= (f right) 0 (f mid)))
> (find-root f mid right)]
> [else
> (find-root f left mid)]))]))
>
>
> Thanks,
> Mike
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130330/4eebd4f7/attachment.html>