Errata in ML for the Working Programmer, 2nd Edition

Chapter 1

12, information box: (Dwight VandenBerghe) Milner's book is now in a new edition. Replace 1990 by 1997.

13, line -1: The last sentence may become out of date. (The Basis Library is still under development, but it ought to be finished by 2005.)

14, line 7: replace "contents are specified" by "contents are specified"

Chapter 2

22 line -14: delete "the" before "booleans"

23 lines 9-10: (Dwight VandenBerghe) omit spaces around "area"

67, line 1: (Tobias Nipkow) The remark about Damas and Milner (1982) is misleading: this paper outlines the framework for proving that types are principal. The proof itself may be found in Damas's 1985 PhD thesis from Edinburgh University.

Chapter 3

91, function delrow. Replace p = hd row by Real.==(p,hd how). (The equality test on reals has become illegal in the past few years. The Basis Library now provides the function Real.== for the equality test.)

93, near bottom (Spyros Sarigiannidis). Replace "the form (u,y) for u<x" by "the form (u,y) for u<x" (less-than or equals).

104, bottom (Nancy Rettew, via Marco Valtorta). Function depth is incorrect. The rev visited in the first pattern produces incorrect answers because it reverses the results of the inner calls too. (The previous function, depthf, is OK because it has no inner calls, and later functions do not reverse their result.) Change the first line to

    fun depth ([], graph, visited) = visited 

and reverse its final result using an explicit call to rev:

    rev (depth (["a"], graph1, []));

117, line 12: replace the test a+b=0.0 by Real.==(a+b,0.0). (See the note above for page 91.)

118, line -8 (Spyros Sarigiannidis): replace "252.0x^5+" by "252.0x^5 +" (insert a space).

Chapter 4

133, line -13 (Stephen Arons): Delete "as keyword@as keyword" . (It is indexing information.)

139, line -13 (Claus-Peter Wirth): In the first call to backChange, delete the first agument, namely []. (This function only accepts two arguments.)

144, line 5 (Spyros Sarigiannidis): Replace 2n by 2n-1.

151, Figure 4.1 (Spyros Sarigiannidis): Node (Egypt, 28) should be (Egypt, 20).

Chapter 5

186, line -2 (Franklin Chen): the expression given to ML should be
foldr op@ [] [[1], [2,3], [4,5,6]];

187, line 3 (Franklin Chen): the expression given to ML should be
foldr newmem [] (explode"Margaret");

209, line 8 (Wei Ke): replace "to the left" by "to the right".

Chapter 6

237, line -12, Exercise 6.20 (Wei Ke): Delete the final right parenthesis.

239, line -6 (Wei Ke): Replace "mathematical induction" by "complete induction".

246: In the last line of the statement of Theorem 19, delete "and a"

249, line -9 (Wei Ke): in tmergesort, replace List.take by take and List.drop by drop. (This example is self-contained and does not refer to external functions.)

Chapter 7

279, line -9 (Wei Ke): ML should respond to the declaration of zz with val zz = ...

280, line 9 (Wei Ke): replace "semir-ing" with "semi-ring"

290, line -6 (Wei Ke): replace 1356 with 1415 (the min operation returns "Agincourt")

Chapter 8

332: in figure all nodes should be the same shade of grey

335,-1 (Namhyun Hur): missing space between "Vector" and "declares"

351, Exercise 8.32: all the escape sequences require a terminating semicolon, as in &lt;. Moreover one may use a literal " instead of the &quot; sequence.

Chapter 9

381 (Claus-Peter Wirth): the first grammar rule for Term is missing the "." symbol: it should be

Term = % Id Id* . Term

Bibliography

452: Grant (1996) has appeared, pages 143-170.

452: Greiner (1996) has appeared, pages 111-141.

453: the URL in Jones (1995) should be http://www.cs.uiowa.edu/~jones/pdp8/

453: in Knuth (1981), the title Seminumerical Algorithms should be italicised

456: the URL in Wadler and Gill (1995) should be http://homepages.inf.ed.ac.uk/wadler/realworld/

Syntax Charts

459 (John Reppy): an include specification may also give an explicit signature. A useful example is "include SIG where type t = int".

Index

469: "~ function 22, 23" is redundant: delete.

472 (Wei Ke): "library, ix" should be "library, xiii"

473 (Wei Ke): "map function/...x sequences" is garbled. The entry (including the previous line) should read "map function/for sequences, 195, 199"

473 (Wei Ke): "ML, evolution of, ix" should be "ML, evolution of, xiii"

473, left column, line -3 (Wei Ke): "Substring structure, 341" should be merged with the "Substring structure" entry near the top of the right column.

469: "as keyword" needs an entry to page 133 (see above)

Predeclared Identifiers

478 (Sarah Mount): function ignore has type 'a->unit, and not int->unit as stated.


An erratum shown in this style has been corrected in the 1997 reprinting

Last revised: Monday, August 30, 2004


Lawrence C. Paulson. Email: lcp@cl.cam.ac.uk