The Artima Developer Community


Errata for Programming in Scala, Third Edition
Chapter 3: Next Steps in Scala
Return to errata index.

Page 45 (PDF page 85):
In Table 3.1 Some List methods and usages, the List method

thrill.sort((s,t) =>
  s.charAt(0).toLower <
    t.charAt(0).toLower)

might need to be corrected to

thrill.sortWith((s,t) =>
  s.charAt(0).toLower <
    t.charAt(0).toLower)

Sincerely

FIXED in 3ed 4th printing
Page 45 (PDF page 85):
(I am reading the book in Amazon Kindle.)
in Table 3.1,

"thrill.sort" is not working.
I think it is a typo of "thrill.sortWith"

FIXED in 3ed 4th printing
Page 45 (PDF page 85):
sort method is depreciated for List type  in version 2.8 and cut off in
later versions and instead sortWith can be used. Sort is mentioned in
table 3.1.

FIXED in 3ed 4th printing
Page 46 (PDF page 86):
thrill.sort((s, t) =>  s.charAt(0).toLower <  t.charAt(0).toLower)

does not compile. An alternative would be

thrill.sortWith((s, t) => s.charAt(0).toLower < t.charAt(0).toLower)

or even more precise

thrill.sortWith((s, t) => s(0).toLower < t(0).toLower)

FIXED in 3ed 4th printing
Page 45 (PDF page 86):
(Note: i'm using the safari online version)

In Step 8 at the end of the table:
thrill.sort((s, t) =>  s.charAt(0).toLower <  t.charAt(0).toLower)

Should be:
thrill.sortWith((s, t) =>  s.charAt(0).toLower <  t.charAt(0).toLower)

FIXED in 3ed 4th printing
Page 49 (PDF page 89):
"In the first line of Listing 3.6 you import the mutable Set."

Actually you import the package scala.collection.mutable.

"As a result, when you say Set on the third
line, the compiler knows you mean scala.collection.mutable.Set."

The third line doesn't say 'Set', it says 'mutable.Set'.

Same problem shows up with Map example later.

FIXED in 3ed 4th printing.
Page 49 (PDF page 89):
It is written,
"Another useful collection class in Scala is Map."
While in Scala api, Map is mentioned as a trait with a companion object.

FIXED in 3ed 4th printing

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.