ERRATA IN "ML for the Working Programmer", 1st printing
[see also ML-ERRATA2.txt and ML-ERRATA3.txt]
Thanks to Andrew Appel, Gavin Bierman, Richard Brooksby, Lal George, Mike
Gordon, Martin Hansen, Darrell Kindred, Khalid Mughal, Tobias Nipkow, Kurt
Olender, Ray Toal, Helen Wilson.
** Chapter 2 **
24 (Mads Tofte): in fun sign, -1 should be ~1 (SERIOUS)
44 (Mike Gordon): Wadsworth, not Turner, invented graph reduction. Should
say "David Turner's application of graph reduction to combinators...".
46, line -12, in exercise 2.11: power(2,29) should be power(2.0, 29)
46, last line (Ray Toal): change "0" to "2".
48, line 1. (Andrew Appel) "nextfib" should be "itfib"
-, line 10 from the bottom (Mads Tofte):
Your "Since m0. Start paragraph with "Suppose n>0".
-, near bottom: "The square root of~$n$ is between $2i$ and $2i+2$."
should be "The square root of~$n$ is $2i$ or $2i+1$."
49, line -12 (Martin Hansen): GCD(n-m,2n+1) should be GCD(n-m,2m+1)
55, second to last paragraph (Darrell Kindred): "If the divisor is
non-zero" should be "If the divisor is zero."
** Chapter 3 **
68 (Helen Wilson) Type "int" should be "string" in 3 places at top of page
72 (Mike Gordon) Second and third lines have an extra ")" -- after cauldron.
85, line 6 (Mads Tofte): the comment should be (* x>= xk *)
instead of (* x > xk *)
100 (Lal George).
"sort" and "samsort" raise exception Match when applied to the empty
list. Calling sorting... sorts the list xs, if xs is nonempty. At bottom
of page, add extra clause to samsort.
** Chapter 4 **
107 (Gavin Bierman) "type" bool should be "datatype" (SERIOUS)
118, line 14 (Mike Gordon): "hander" -> "handler"
118, line 16 (Ray Toal): "xs" should be in italics as it is not a keyword
119 (Kurt Olender): Exercise 4.12. Last sentence: "Including the
exception declarations" should be "Include the exception declarations"
134 (Mads Tofte): comment in second line of upheap: (* assume k>1 *)
should be (* assume n>1 *)
** Chapter 5 **
170, line 9 (Mike Gordon): "squareq" should be "squares"
** Chapter 6 **
192, lines 15, 16 (Mike Gordon). The following is wrong:
If k=2m then k+1 = 2m'+1, so m'=m
If k=2m+1 then k+1 = 2m'+2 = 2(m'+1), so m'=m+1
Three of the primes should be deleted; it should be
If k=2m then k+1 = 2m+1, so m'=m
If k=2m+1 then k+1 = 2m+2 = 2(m+1), so m'=m+1
200, Line -3 (Mike Gordon). At far right, [nlength] should be [@]
219: (Kurt Olender): Last line of proof about 25% down page from top
"The the conclusion holds"
** Chapter 7 **
252 (Richard Brooksby): The signature TREE does not match the structure
Tree. The name of the datatype should be 'a T not 'a tree. (SERIOUS)
275, lines 2 and 4. (Khalid Mughal) Type "T" should be "key".
** Chapter 8 **
282, line -6 (Khalid Mughal): "make" should be "makes"
283 (Mads Tofte): Exercise 8.2. If E side-effects id then there is no
solution, because calling +:= evaluates E before the function can get the
contents of id. Also, overloading of + cannot be handled. Ignoring
overloading, the exercise CAN be solved using a curried function:
fun +:= r = let val v0 = ! r in fn v => r:= v0 + v end;
Try "Define a function +:= such that +:= Id E has the same effect as Id :=
!Id + E, for integer E."
** Chapter 9 **
334, line -12: "independent of ^ order" -- insert "the"
347 "iszero 0" -- the 0 should be underlined
347 (middle): Poor choice of variable names (especially y!) in "A suitable
$g$ is a function on pairs such that $g(x,y)=(f(x),x)$". Could change to
$g(z,z')=(f(z),z)$".
**** Syntax diagram errors found by Tobias Nipkow ****
412 top: "Functor" (in teletype font) should be in lower case
413 middle: "Type" (in teletype font) should be in lower case (after
"sharing")
415 top: should line up the vertical arrows in the first 2 cases of
Function Heading. Move "Atomic Pattern" to right in top line. Allows
infix $; fun f (x$y) z = ...)
420 near bottom: in Type Var, - should be _ and the first downwards
arrowhead should be removed
421 near top: in Alphanumeric Ident, - should be _