|
The third printing of the book may contain the following mistakes. They have been corrected in the on-line version:
|
The following items correct errors in the first and second printing of the book. They have all been corrected in the third printing of the book and the on-line version.
The problem statement correctly specifies that "[d]ecreasing the price by a dime ($.10) increases attendance by 15." Later, the book includes the sentence "The base attendance at a price of five dollars is 120, and for each 15 cents less than five dollars, 10 more attendees show up." This second claim is incorrect.
Thanks to Chuck Floyd, Kerrville, TX
The book specifies that
;;A shape is either ;;1. a circle, or ;;2. a structure.Naturally, this should be
;;A shape is either ;;1. a circle, or ;;2. a square.
Thanks to Jamie Raymond, Houston, TX
The book incorrectly defines our-cons as:
(define (our-cons a-value a-list) (make-pair a d))It should be
(define (our-cons a-value a-list) (make-pair a-value a-list))
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
(define (our-cons a-value a-list)
(cond
[(empty? a-list) (make-pair any a-list)]
[(our-cons? a-list) (make-pair any a-list)]
[else (error 'cons "list as second argument expected")]))
should be
(define (our-cons a-value a-list)
(cond
[(empty? a-list) (make-pair a-value a-list)]
[(our-cons? a-list) (make-pair a-value a-list)]
[else (error 'our-cons "list as second argument expected")]))
Thanks to Nguyen Cong Vu, Ho Chi Min City, Viet Nam
The book mistakenly specifies random as a function that
consumes a natural number. Instead, random consumes an integer
greater than or equal to 1 (and less than or equal to 2147483647).
Thanks to Marvin D. Hernandez, Miami, FL
The exercise had been misinterpreted twice. The new wording is: and produces a list of that many numbers, each randomly chosen from the range from 20 to 120.
Develop the functiontie-dyed. It consumes a natural number and produces a list of that many numbers, each randomly chosen in the range from20to120. Usetie-dyedto applydraw-circlesfrom exercise~9.5.8.
Thanks to Stephen Bloch, New York, NY
The section switches from the development of a descending sort to that
of an ascending sort during the transition from the development of
sort to the development of insert.
Figure 33 (page 175) should be as follows:
;; |
Thanks to Daniel P. Friedman, Bloomington, IN
"make-structure" should be "make-mail".
We have added the following paragraph at the end of the page:
Also, use the Scheme operation append, which consumes two lists
and produces the concatenation of the two lists. For example:
(append (list 'a 'b 'c) (list 'd 'e)) = (list 'a 'b 'c 'd 'e)
Thanks to Stephen Bloch, Garden City, NY
(list-pick (cons 'a empty) 3) ;; expected value: falseshould be(list-pick (cons 'a empty) 3) ;; expected value: (error 'list-pick "...")
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
Replace all occurrences of
(define (list-pick n alos)
with
(define (list-pick alos n)
Thanks to Jesse Janzer and Matthew Litman, Atlanta, GA.
Replace all occurrences of false with
(error 'list-pick "list too short")
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
4. (+ (local ((define (f x) (g (+ x 1))) (define (g x y) (+ x y))) (f 10)) 555)should be
4. (+ (local ((define (f x) (g (+ x 1) 22)) (define (g x y) (+ x y))) (f 10)) 555)
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
Abstract the functionsExercise 21.4.2 should read:draw-a-circleandclear-a-circleinto a single functionprocess-circle.
Definetranslate-circleusingprocess-circle.
Abstract the functionsdraw-a-rectangleandclear-a-rectangleinto a single functionprocess-rectangle.
Definetranslate-rectangleusingprocess-rectangle.
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
The definition of sort is incorrect. It should be as
follows:
|
Thanks to David Kay, Irvine, CA
The enumerations are missing a number each. Here are the correct versions:
1. 18 is evenly divisible by 1, 2, 3, 6, 9, and 18; 2. 24 is evenly divisible by 1, 2, 3, 4, 6, 8, 12, and 24.
Thanks to Daniel P. Friedman, Bloomington, IN
The sequence of Bezier images is misleading. Here is an improved version:
Design file->list-of-checks. The function consumes a file of
numbers and outputs a list of restaurant records.
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
The application of make-last-item in invert
receives the arguments in the wrong order:
(define (invert alox)
(cond
[(empty? alox) empty]
[else (make-last-item (first alox) (invert (rest alox)))]))
|
Thanks to Daniel P. Friedman, Bloomington, IN
"Its solution is x = 2, y = 1, and z = 1"in reference to the list-specified system of equations. Instead, it should read:
"Its solution is x = 1, y = 1, and z = 1"
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
Figure 81 contains a mistake in the definition of
vector-sum. Here is the correct version:
;; |
Thanks to Nguyen Cong Vu, Open University, Ho Chi Minh City, Viet Nam
The function definition in exercise 37.2.7 should read as follows:
(define (reveal-list! cw sw guess)
(local ((define (reveal-one chosen-letter status-letter)
(cond
[(symbol=? chosen-letter guess) guess]
[else status-letter])))
(set! status-word (map reveal-one cw sw))))
|
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
In exercise 38.4.3, part 3 the program is illegal in Advanced Scheme. Here is the corrected version:
(define (make-box x)
(local ((define contents x)
(define (new y)
(set! contents y))
(define (peek)
contents))
(list new peek)))
|
Thanks to Dung X. Nguyen, Houston, TX.
In exercise 38.4.4 the make-box function is illegal in
Advanced Scheme. Here is the corrected version:
(define (make-box x)
(local ((define contents x)
(define (new y)
(set! contents y))
(define (peek)
contents))
(list new peek)))
|
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
The contract and header for count-a-vowel are repeatedly
misstated. Here is the correction:
;; |
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
The definition of for-interval should be as follows:
|
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
We have also found the following typos:
area-of-disk program ..."
should be
"The area-of-ring program ..." (R. Egli)
"for process" should be "for a process" (D.P. Friedman)
revenue : number number -> number
should be
revenue : number -> number
perimeter-circle should use circle-radius [not
circle-length] (G. Hosford)
(define (tabulate-f-up-to-20 n-above-20) ...)
should be
(define (tabulate-f-up-to-20 n-below-20) ...)
Hrvoje Blazevic
(draw-solid-line (first a-poly) (second a-poly) RED)
should be
(draw-solid-line (first a-poly) (second a-poly) 'red)
(J. Raymond)
dir structure" in 16.3.3
(Hrvoje Blazevic)
reveal-list instead of
reveal
(Hrvoje Blazevic)
(interpret-with-one-def (substitute val-of-arg fun-para fun-body) a-fun-def)
should be
(interpret-with-one-def (subst ... ... ...) a-fun-def)
local definitions" should be "a good
understanding of local definitions" (D.P. Friedman)
(local ((define (f x) exp-1))) exp)
should be
(local ((define (f x) exp-1)) exp)
(H. Blazevic)
(local ((define PI 3))) exp)
should be
(local ((define PI 3)) exp)
(H. Blazevic)
= (define y 10) (define y1 10) (define z1 20) (+ 10 z1)was duplicated (Nguyen Cong Vu)
(cons 6 empty)
should be
(cons 4 empty)
(H. Blazevic)
filter2 : (X Y -> boolean) -> (Y (listof X) -> (listof X))
filter2 : (X Y -> boolean) -> ((listof X) Y -> (listof X))
(H. Blazevic)
draw-message:
gui-item [message%] string -> true
get-text should be text-contents
(J. Zachary)
(define digit-choosers
(build-list 3 (lambda (i) (make-choice DIGITS))))
(define digit-choosers
(local ((define (builder i) (make-choice DIGITS)))
(build-list 3 builder)))
(H. Blazevic)
graph-line. The operation consumes a line like
y and a color, say, RED." graph-line. The operation consumes a line like y and a
color, say, 'red." (Joe Zachary)
(define (fprime (d/dx f))))
should be
(define fprime (d/dx f)))
(H. Blazevic)
lo-originations to
destination" should be ";; to create a path from some node on
lo-Os to D" (J. Zachary)
(find-route 'B 'D Cyclic-graph)
= ... (find-route 'B 'D Cyclic-graph) ...
= ... (find-route/list (list 'E 'F) 'D Cyclic-graph) ...
= ... (find-route 'E 'D Cyclic-graph) ...
= ... (find-route/list (list 'C 'F) 'D Cyclic-graph) ...
= ... (find-route 'C 'D Cyclic-graph) ...
= ... (find-route/list (list 'B 'D) 'D Cyclic-graph) ...
= ... (find-route 'B 'D Cyclic-graph) ...
= ...
(H. Blazevic)
norm, which consumes a vector of numbers and
produces the square root of the sum of the squares of its
numbers. (H. Blazevic)
A second difference between the two functions concerns the order of addition. While the original version of sum adds up the numbers from right to left, the accumulator-style version adds them up from left to right.Furthermore, replace
(sum (g-series 1000))
with (sum (g-series #i1000))
(H. Blazevic)
all-blue-eyed-ancestors loses"
should be
"this application of all-blue-eyed-ancestors loses"
(D.P. Friedman)
(set! (if z x y) 5)
should be
(set! (z x y) 5)
(H. Blazevic)
defined at top-level variable"
should be
"a variable defined at top-level"
(D.P. Friedman)
chosen-word
but to use '_ as the letters."
should be
"Thus, the matching action is to build a word as long as
chosen-word from '_.
(D.P. Friedman)
chosen-wor
should be
chosen-word
(D.P. Friedman)
next-color requires a closing ")". (D. Smith)
'sunrise@cmu to green. (H. Blazevic)
(define (board-set! a-board i j) ...)
should be
(define (board-flip! a-board i j) ...)
(H. Blazevic)
reset : -> true
should be
reset : -> void
(H. Blazevic)
hand0 becomes a card with two hands"
should be
"hand0 becomes a hand with two cards"
(H. Blazevic)
(sorted-insert! 1 CLUBS hand0)
should be
(sorted-insert! 2 CLUBS hand0)
(D.P. Friedman)
manage))"
should be
"service-manager))"
Furthermore, the defininition of service-manager should be:
(define (service-manager msg)
(cond
[(symbol=? msg 'insert!)
(lambda (r s)
(cond
[(> r (hand-rank the-hand))
(set! the-hand (make-hand r s the-hand))]
[else (insert-aux! r s the-hand)]))]
[else (error 'managed-hand "message not understood")]))
(H. Blazevic)
equal-posn?: posn posn -> boolean"
should be
"equal-posn : posn posn -> boolean"
(H. Blazevic)
;; eq-posn? : posn posn -> boolean
;; to determine whether two posn structures
;; are affected by the same mutation
(define (equal-posn p1 p2) ...)
should be
;; eq-posn : posn posn -> boolean
;; to determine whether two posn structures
;; are affected by the same mutation
(define (eq-posn p1 p2) ...)
"
(define (equal-posn p1 p2)
"
should be
"
(define (eq-posn p1 p2)
"
(H. Blazevic)
(define (equal-posn p1 p2)
"
should be
"
(define (eq-posn p1 p2)
"
equal-posn should always be eq-posn
should be
;;
eq-posn? : posn posn -> boolean
;; to determine whether two posn structures
;; are affected by the same mutation
(define (equal-posn p1 p2) ...)
(H. Blazevic)
;;
eq-posn : posn posn -> boolean
;; to determine whether two posn structures
;; are affected by the same mutation
(define (eq-posn p1 p2) ...)
(define (partition V left right)
(local ((define pivot-position left)
(define the-pivot (vector-ref V left))
(define (partition-aux left right)
(local ((define new-right (find-new-right V the-pivot right left))
(define new-left (find-new-left V the-pivot left right)))
... )))
(partition left right)))
should be
(define (partition V left right)
(local ((define pivot-position left)
(define the-pivot (vector-ref V left))
(define (partition-aux left right)
(local ((define new-right (find-new-right V the-pivot left right))
(define new-left (find-new-left V the-pivot left right)))
... )))
(partition-aux left right)))
(H. Blazevic)
(define (partition V left right)
(local ((define pivot-position left)
(define the-pivot (vector-ref V left))
(define (partition-aux left right)
(local ((define new-right (find-new-right V the-pivot right left))
(define new-left (find-new-left V the-pivot left right)))
(cond
[(>= new-left new-right)
(begin
(swap V pivot-position new-right)
new-right)]
[else
(begin
(swap V new-left new-right)
(partition-aux new-left new-right))]))))
(partition-aux left right)))
should be
(define (partition V left right)
(local ((define pivot-position left)
(define the-pivot (vector-ref V left))
(define (partition-aux left right)
(local ((define new-right (find-new-right V the-pivot left right))
(define new-left (find-new-left V the-pivot left right)))
(cond
[(>= new-left new-right)
(begin
(swap V pivot-position new-right)
new-right)]
[else ; (< new-left new-right)
(begin
(swap V new-left new-right)
(partition-aux new-left new-right))]))))
(partition-aux left right)))
(H. Blazevic)
(list 1.10 329/300 328/300)
should be
(list 1.10 329/300 82/75)
(H. Blazevic)