Typos
Mistakes
and
Typos
in
How to Design Programs
Mistakes:
The third printing of the book may contain the following
mistakes
. They have been corrected in the on-line version:
page 136:
(dollar-store? (cons .75 (cons 0.95 (cons .25 empty))))
should be
(dollar-store? (cons .75 (cons .95 (cons .25 empty))))
(D. Tucker)
page 313: Figure 57 mistakenly states the contract for the built-in
sort function as
quick-sort : (X X -> boolean) (listof X) -> (listof X)
The actual contract is:
quicksort : (listof X) (X X -> boolean) -> (listof X)
(J. Cone)
page 317: Exercise 21.4.5 had to be revised as follows to conform to
the interface of the
arrow.ss
teachpack:
Modify the functions of exercises 21.4.3 and 21.4.4 so that pictures
move up and down on a canvas.
Modify all definitions so that a shape can also be a line; a line has a
start position, an end position, and a color.
Define
LUNAR
, a list that sketches a lunar lander picture
(see figure 58). The list should consist of rectangles, circles, and lines.
Develop the program
lunar-lander
. It places LUNAR at the top of a
canvas and then uses the modified functions to move the lander up or down.
Use the teachpack
arrow.ss
to give users control over how fast and when
the lunar lander should move:
(start 500 100)
(draw LUNAR)
(control-up-down LUNAR 10 move-lander draw-losh)
If time permits, modify the function so that a player can move the lander up,
down, left or right. Use
controller
from
arrow.ss
to control the
movements in all directions.
Thanks to Dung Nguyen and David Kay, Irvine, CA
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.
page 24:
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
page 92 (figure 19)
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
page 122
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)
page 122:
(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
page 158 (exercise 11.3.1)
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
page 159 (exercise 11.3.2)
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 function
tie-dyed
. It consumes a natural number and
produces a list of that many numbers, each randomly chosen
in the range from
20
to
120
. Use
tie-dyed
to apply
draw-circles
from exercise~9.5.8.
Thanks to Stephen Bloch, New York, NY
pages 172-175
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:
;;
sort : list-of-numbers -> list-of-numbers
;; to create a list of numbers with the same numbers as
;;
alon
sorted in descending order
(define (sort alon)
(cond
[(empty? alon) empty]
[(cons? alon) (insert (first alon) (sort (rest alon)))]))
;;
insert : number list-of-numbers (sorted) -> list-of-numbers
;; to create a list of numbers from
and the numbers on
;;
alon
that is sorted in descending order;
alon
is sorted
(define (insert n alon)
(cond
[(empty? alon) (cons n empty)]
[else (cond
(>= n (first alon))
(cons n alon)]
(< n (first alon))
(cons (first alon) (insert n (rest alon)))])]))
Thanks to Daniel P. Friedman, Bloomington, IN
page 174
"make-structure" should be "make-mail".
page 182
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
page 236
(list-pick (cons 'a empty) 3)
;; expected value:
false
should be
(list-pick (cons 'a empty) 3)
;; expected value:
(error 'list-pick "...")
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
pages 237-241:
Replace all occurrences of
(define (list-pick n alos)
with
(define (list-pick alos n)
Thanks to Jesse Janzer and Matthew Litman, Atlanta, GA.
pages 240, 241
Replace all occurrences of
false
with
(error 'list-pick "list too short")
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
pages 267
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)
pages 316, 317:
Exercise 21.4.1 should read :
Abstract the functions
draw
-a-
circle
and
clear
-a-
circle
into a
single function
process-circle
Define
translate-circle
using
process-
circle
Exercise 21.4.2 should read:
Abstract the functions
draw
-a-
rectangle
and
clear
-a-
rectangle
into a single
function
process-rectangle
Define
translate-rectangle
using
process-
rectangle
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
page 319
The definition of
sort
is incorrect. It should be as
follows:
;; sort : (listof number) -> (listof number)
(define (sort
a-list
(local ((define (insert an alon)
(cond
[(empty? alon) (list an)]
[else (cond
[(> an (first alon)) (cons an alon)]
[else (cons (first alon) (insert an (rest alon)))])])))
(reduce empty insert
a-list
)))
Thanks to David Kay, Irvine, CA
page 376
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
page 386
The sequence of Bezier images is misleading. Here is an improved
version:
page 390: Exercise 27.2.3 should read:
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)
page 451
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
page 404/405: The text states that
"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)
page 432
Figure 81 contains a mistake in the definition of
vector-sum
. Here is the correct version:
;;
vector-sum : (vectorof number) -> number
;; to compute the sum of the numbers in
(define (vector-sum v)
(vector-sum-aux
v (vector-length v)
))
Thanks to Nguyen Cong Vu, Open University, Ho Chi Minh City, Viet Nam
page 534:
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)
page 558
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.
page 564
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)
pages 620, 621:
The contract and header for
count-a-vowel
are repeatedly
misstated. Here is the correction:
;;
count-a-vowel : letter (vector number number number number number) -> void
;; effect: to modify
counts
at the appropriate place if
is a vowel,
;; none otherwise
(define (count-a-vowel l counts)
...)
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
page 658:
The definition of
for-interval
should be as follows:
(define (for-interval i end? step action)
(cond
[(end? i) (action i)]
[else
(begin
(action i)
(for-interval (step i) end? step action)])))
Thanks to Hrvoje Blazevic (Master, LPG/C Harriette N)
Typos:
We have also found the following
typos
page 7: "lanuages" should be "languages" (D.P. Friedman)
page 16: "DrScheme's catches" should be "DrScheme catches" (D.P. Friedman)
page 20: "for process" should be "for a process" (D.P. Friedman)
page 21:
"The
area-of-disk
program ..."
should be
"The
area-of-ring
program ..." (R. Egli)
"for process" should be "for a process" (D.P. Friedman)
page 23:
revenue : number number -> number
should be
revenue : number -> number
page 25 (figure 5): replace "attendance" with "attendees" (J. Zachary)
page 26: "in the both columns" should be "in both columns"
(D.P. Friedman)
page 28: "invokes" should be "evokes" (J. Zachary)
page 34: 4.2.2 "four" should be "three"
page 36: Read: "After clicking the Execute button we can compare the two
numbers." (Joe Zachary)
page 59: the box should contain '606-7771 in its "phone" compartment (M. D. Hernandez)
page 67: superfluous ")" at end of first expected value (M. D. Hernandez)
page 81: wrong font for "first" in structure definition (D.P. Friedman)
page 84: two extra "}" in the data definition of shape
page 86: two extra "}" in the data definition of shape (D. Tucker)
page 92: figure 19, right hand column definition of
perimeter-circle
should use
circle-radius
[not
circle-length
] (G. Hosford)
page 108: "when we evaluate an the error expression" should be "when we
evaluate the error expression" (V. Proulx)
page 108: "must look the pragmatics" should be "must look at the pragmatics" (D.P. Friedman)
page 119: "juice brie cheese" should be "juice, brie-cheese" (D. Tucker, G. Hosford)
page 134: "on on" should be "on" (D.P. Friedman)
page 140: "euro accounts" should be "euro amounts"
page 143: "a the" should be "the" (D.P. Friedman)
page 146: "each objects" should be "each object"
page 153: read: "flavors
of
definitions" (Joe Zachary)
page 154: read "A function on natural numbers must extract the number
that went into
the construction of
a positive
natural number" (Joe Zachary)
page 158: "namers" should be "names" (Joe Zachary)
page 159: "The typical riot uses \scheme{'red} only." should be
"The typical riot uses \scheme{RED} only."
page 159: "Develop the function \scheme{create-prices}, which consumes
a natural number and produces a list with a corresponding
number
of prices between \$.10 and \$10.00 with
increments of a dime."
page 162: "cond-clauses" should be "cond-clause" (Joe Zachary)
page 166:
(define (tabulate-f-up-to-20 n-above-20) ...)
should be
(define (tabulate-f-up-to-20 n-below-20) ...)
Hrvoje Blazevic
page 167, exercise 11.5.2: "Eliminate + from these definitions, too." should be
"Eliminate + from this definition, too." (B. Duba)
page 169: "means of combining" should be "means combining" (J. Zachary)
page 172: "create a sorted list" should be "creates a sorted list" (D.P. Friedman)
page 178: "we discuss the first alternative" should be "we discuss the
second alternative" (S. Bloch)
page 179 (figure 34):
(draw-solid-line (first a-poly) (second a-poly) RED)
should be
(draw-solid-line (first a-poly) (second a-poly) 'red)
(J. Raymond)
page 192: "conventions concerning on" should be "conventions concerning on"
(D.P. Friedman)
page 198:
"The contracts differ slightly."
should be
"The results differ slightly."
(S. Bloch)
page 201: "tha is" should be "that is" (D.P. Friedman)
page 202: "larger than 65" should be "larger than 66" (Joe Zachary)
page 215: ex 15.1.2: The second sentence should read
"It determines how far the first
blue-eyed descendant, if one exists, is removed from the given parent."
(Sharon Salveter)
page 218: "fun-for-parent" should be "fun-parent",
"for-for-loc" should be "fun-children" (D.P. Friedman)
page 223: "the file named read!" should be "a file named read!" (Joe Zachary)
page 225: "directly apply to" should be "directly applies to" (D.P. Friedman)
page 227: added "Do not define your own dir structures." to create-dir
(Hrvoje Blazevic)
page 228:
changed "in the content field" to
"in a
dir
structure" in 16.3.3
(Hrvoje Blazevic)
page 235: "that a natural" should be "that consumes a natural" (D.P. Friedman)
page 236:
change all occurrences of null? to empty?
(Hrvoje Blazevic)
page 239: "like list-pick0" should be "like list-pick" (D.P. Friedman)
page 240: "consider the second part" should be "consider the first part" (D.P. Friedman)
page 244: "data definition data definition" should be "data definition" (D.P. Friedman)
page 244: "choses" should be "chooses"
page 244:
in the three test cases, use
reveal-list
instead of
reveal
(Hrvoje Blazevic)
page 247: "if it the pattern" should be "if the pattern" (D.P. Friedman)
page 249:
(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)
page 253: "contain the numbers" should be "contain the same numbers" (D.P. Friedman)
page 258: "test cases" should be "test" (D.P. Friedman)
page 258: In Ex. 17.8.11, "section 17.1" should be "section 17.3"
(Jeffere H.)
page 259: "a good
local
definitions" should be "a good
understanding of
local
definitions" (D.P. Friedman)
page 261: "Determine which of the following definitions or expressions
is legal and which one is not:" should be "Determine which of the following
definitions or expressions are legal and which ones are not:"
(D.P. Friedman)
page 266:
(local ((define (f x) exp-1))) exp)
should be
(local ((define (f x) exp-1)) exp)
(H. Blazevic)
page 266:
(local ((define PI 3))) exp)
should be
(local ((define PI 3)) exp)
(H. Blazevic)
page 263: "f-1' instead of f-11" should be "f-1' instead of f-1" (D.P. Friedman)
page 264: "which of y's" should be "which of the y's" (D.P. Friedman)
page 264:
= (define y 10)
(define y1 10)
(define z1 20)
(+ 10 z1)
was duplicated (Nguyen Cong Vu)
page 269: "lists of records on rock stars" should be "lists of records
of rock stars" (Joe Zachary)
page 270: "For 'Sean," should be "For 'Wen," (D.P. Friedman)
page 273: "in in" should be "in" (D.P. Friedman)
page 274: "to write to" should be "to write two" (D.P. Friedman)
page 276: "variables, function, and structures" should be "variables,
functions, and structures" (Joe Zachary)
page 287:
(cons 6 empty)
should be
(cons 4 empty)
(H. Blazevic)
page 291: "The first variant flattened ..." should be "The first variant
flattens ..." (Joe Zachary)
page 292: "Test each of them with the following two lists:"
should be
"Test each of them with the following three lists:"
(H. Blazevic)
page 295: the foonote was accidentally inlined (D.P. Friedman)
page 316: "perparation" should be "preparation"
page 324:
filter2 : (X Y -> boolean) -> (Y (listof X) -> (listof X))
should be
filter2 : (X Y -> boolean) -> ((listof X) Y -> (listof X))
(H. Blazevic)
page 327: "to obtain obtain" should be "to obtain" (D.P. Friedman)
page 328: Here is the correct contract of
draw-message
gui-item [message%] string -> true
get-text
should be
text-contents
(J. Zachary)
page 330: "functionq" should be "function" (D.P. Friedman)
page 331:
(define digit-choosers
(build-list 3 (lambda (i) (make-choice DIGITS))))
should be
(define digit-choosers
(local ((define (builder i) (make-choice DIGITS)))
(build-list 3 builder)))
(H. Blazevic)
page 338:
"multiplying a fixed constant wit"
should be
"multiplying a fixed constant with" (Joe Zachary)
page 339:
"to add just a few of the first few terms"
should be
"to add just the first few terms"
(D.P. Friedman)
page 346: "The teachpack graphing.ss provides two operations for
drawing lines:
graph-line
. The operation consumes a line like
and a color, say,
RED
."
should be
"The
teachpack graphing.ss provides one operation for drawing lines:
graph-line
. The operation consumes a line like
and a
color, say,
'red
." (Joe Zachary)
page 349:
"the answer will be depend on e" should be
"the answer will depend on e" (H. Blazevic)
page 358:
"until drops"
should be
"until it drops
off the table"
(D.P. Friedman)
page 359 (figure 66): the two occurrences of
RED
should be
'red
(H. Blazevic)
page 359: "directiones" should be "directions" (J. Zachary)
page 369:
how
the it works"
should be
how
it works"
(D.P. Friedman)
page 373: "algorith" should be "algorithm"
page 379: "wreck" should be "wreak" (J. Zachary)
page 393: "Here f(m) > 0," should be "Here f(m) < 0," (H. Blazevic)
pages 392-395: "Mean Value Theorem" should be "Intermediate Value
Theorem" (B. Richter)
page 400:
(define (fprime (d/dx f))))
should be
(define fprime (d/dx f)))
(H. Blazevic)
page 405: "2 x + 2 y + z z = 2" should be "2 x + 2 y + z = 2"
(H. Blazevic)
page 411: ";; to create a path from some node on
lo-originations
to
destination
" should be ";; to create a path from some node on
lo-Os
to
" (J. Zachary)
page 412: the calculation should read:
(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)
page 425: "a functions running time" should be "a function's running time"
(D.P. Friedman)
page 434 (ex. 29.4.7): The exercise should read:
Develop the function
norm
, which consumes a vector of numbers and
produces
the square root of the sum of the squares of its
numbers.
(H. Blazevic)
page 435: "veloicity" should "velocity"
(Nguyen Cong Vu, Open University, Ho Chi Minh City, Viet Nam)
page 437:
"a vector of the same how-many as" should be "a vector of the same length as"
(D.P. Friedman)
page 441:
"this loss make a" should be "this loss makes a"
(D.P. Friedman)
page 447: "(rest ag)" should be "(rest sg)" (H. Blazevic)
page 457: Exercise 31.3.1 should read
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)
page 467:
"this application
all-blue-eyed-ancestors
loses"
should be
"this application of
all-blue-eyed-ancestors
loses"
(D.P. Friedman)
page 474:
"for the states we have reach so far"
should be"
for the states we have reached so far"
(D.P. Friedman)
page 477:
"consume a the board"
should be
"consume a board"
(D.P. Friedman)
page 481:
"choice is to round the number and to the closest representable equivalent"
should be
"choice is to round the number to the closest representable equivalent"
(D.P. Friedman)
page 498:
(set! (if z x y) 5)
should be
(set! (z x y) 5)
(H. Blazevic)
page 504:
"a variable
define
d at top-level variable"
should be
"a variable
define
d at top-level"
(D.P. Friedman)
page 504:
"Supposed we evaluate"
should be
"Suppose we evaluate"
(D.P. Friedman)
page 517:
"whether the functions has the desired result"
should be
"the function has the desired result and effect"
(D.P. Friedman)
page 517: "efffects" should be "effects"
page 518:
"a particular good one"
should be
"a particularly good one"
(D.P. Friedman)
page 523 (figure 103): "check-guess" should be "check-color" (H. Blazevic)
page 528:
"Thus, the matching action is a build a word as long as
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)
pages 536/537:
chosen-wor
should be
chosen-word
(D.P. Friedman)
page 566:
"Alonzo Church in the last 1920s as follows:"
should be
"Alonzo Church in the late 1920s as follows:"
(D.P. Friedman)
page 575: The last line of the definition of
next-color
requires a closing ")". (D. Smith)
page 577: This sets the light at
'sunrise@cmu
to green. (H. Blazevic)
page 595
"in the structure name p"
should be
"in the structure named p"
(D.P. Friedman)
page 603:
(define (board-set! a-board i j) ...)
should be
(define (board-flip! a-board i j) ...)
(H. Blazevic)
page 616
"a self-referential descriptions"
should be
"a self-referential description"
(D.P. Friedman)
page 616:
reset : -> true
should be
reset : -> void
(H. Blazevic)
page 625:
hand0
becomes a card with two hands"
should be
hand0
becomes a hand with two cards"
(H. Blazevic)
page 629:
"preceeds"
should be
"precedes"
(D.P. Friedman)
page 631
(sorted-insert! 1 CLUBS hand0)
should be
(sorted-insert! 2 CLUBS hand0)
(D.P. Friedman)
page 634:
the last line of figure 124,
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)
page 635:
"determing"
should be
"determining"
(D.P. Friedman)
page 636:
"structure-mutating the functions"
should be
"structure-mutating functions"
(D.P. Friedman)
page 637:
equal-posn?: posn posn -> boolean
should be
equal-posn : posn posn -> boolean
(H. Blazevic)
page 639:
;;
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)
page 640:
(define (equal-posn p1 p2)
should be
(define (
eq-posn
p1 p2)
equal-posn
should always be
eq-posn
;;
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) ...)
(H. Blazevic)
page 641: ex. 42.2.1
eq-posn?
should be
eq-posn
(H. Blazevic)
page 655:
(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)
page 656 (figure 131):
(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)
page 658:
(list 1.10 329/300 328/300)
should be
(list 1.10 329/300
82/75
(H. Blazevic)
page 660:
"related with each other"
should be
"related to each other"
(D.P. Friedman)
page 670:
"cannot possible produce"
should be
"cannot possibly produce"
(D.P. Friedman)
page 678: "extrance" should be "entrance"
The Authors