The Artima Developer Community


Errata for Programming in Scala
Chapter 23: For Expressions Revisited
Return to errata index.

Page 482 (PDF page 509):
l.-2/-3 generators that that bind
-->                   that

FIXED
Page 482 (PDF page 509):
Line 5:
Replace "The next case handles for expressions that statrt with two
filters..." with "The next case handles for expressions that statrt with
two generators...".

FIXED
Page 483 (PDF page 510):
First paragraph, second expression: expr should be replaced by expr1.

FIXED
Page 481 (PDF page 519):
"In that case, you need to abort that part of the search in order to
continue with a different configuration of queens in [rows] 1 to k−1."
Page 483 (PDF page 521):
l.9 expr.map { case
--> expr_1.map

FIXED (see it in 3rd printing)
Page 487 (PDF page 525):
"
for (x <- expr_1 if expr_2; seq) yield expr_3
is translated to
for (x <- expr_1 withFilter (x => expr_2); seq) yield expr_3
"

( "expr_2" is replaced by "(x => expr_2)". )
Page 506 (PDF page 544):
In chapter 24:

"xs.zipWithIndex: An iterable of pairs of elements from xs with
their [indicies]"
Page 510 (PDF page 548):
"xs.lengthCompare ys: Returns -1 if xs is shorter than ys, +1 if it is
longer, and 0 is they have the same length. Works even if one [of] the
sequences is infinite."
Page 518 (PDF page 556):
"Or you can leave out the ordering argument but give an element type [of]
the empty set."
Page 519 (PDF page 557):
footnote 3: "Immutable bit sets of elements in the range of 0 to 127
optimize the array away and store the bits directly in [] one or two Long
fields."
Page 524 (PDF page 562):
"You could also have implemented cachedF directly, using just basic map
operations, but it would { have have } taken more code to do so: [...]"
Page 530 (PDF page 568):
"A push on an immutable stack is the same as a :: on a list, and a pop on
a stack is the same [as] a tail on a list."
Page 540 (PDF page 578):
"[On] the one hand, Scala arrays correspond one-to-one to Java arrays.
That is, a Scala array Array[Int] is represented as a Java int[], an
Array[Double] is represented as a Java double[] and an Array[String] is
represented as a Java String[]. But at the same time, Scala arrays offer
much more [than] their Java analogues."
Page 561 (PDF page 599):
"it.zipWithIndex: An iterator of pairs of elements returned from it with
their [indices]."
Page 563 (PDF page 601):
"[...] or whether it is an trait such as Seq, Set, or Traversable."
Page 571 (PDF page 609):
"class TraversableLike[+Elem, +Repr] {"

should read

"trait TraversableLike[+Elem, +Repr] {"

Page number: Book type: Paperback book PDF eBook
Book version: (Or build date. Found on back of title page.)
Your feedback:
Your name: (optional)
Your email address: (optional) (will not be published)

Copyright © 2021 Artima, Inc. All rights reserved.