Errata

Learning Scala

Errata for Learning Scala

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
ePub Page cover page
cover image

phenomenon:
the cover image is not shown with the iBooks app on the iOS and in the file property information of the finder on the OSX.

confirmed version:
Learning Scala.epub - meta property "dcterms:modified" = 2014-10-14T17:49:33Z
under iOS 7.1.2 and iBooks 3.2 (2083)

cause:
no cover-image property found in the item element of "content.opf" file.

at line 73 in content.opf
<item id="cover-image" href="images/orm_front_cover.png" media-type="image/png"/>

expected:
line 73 should be following a line.
<item id="cover-image" properties="cover-image" href="images/orm_front_cover.png" media-type="image/png"/>

Anonymous  Oct 21, 2014 
ePub Page Table 6-6
Table 6-6

The description of the mkString method in table 6-6 says that it renders a collection to a set. It actually creates a string.

Matthew Halverson   Jul 12, 2016 
Other Digital Version Kindle location 2705 of 6135, Table 7-2. Sequence Types

TYPO technical error in Table 7-2. Sequence types: In the Queue listing Description the Queue is described as “a first-in-last-out” list. This should read, as the abbreviation in the table suggests, a first-in-first-out (FIFO) sequence.

Tom Pittard  Jun 26, 2017 
Printed Page 7
2nd paragraph

Exercise 5 suggests using :paste -raw
But if I paste in the following line
println("Hello world.")

I get the following:
// Exiting paste mode, now interpreting.

<pastie>:1: error: expected class or object definition
println("Hello world.")
^
There were compilation errors!


However, if I just use :paste everything works as expected.

John Langley  Apr 06, 2015 
PDF Page 15
Table 2-1

Byte range is -128 to 127, not -127 to 128.

Anonymous  Feb 24, 2018 
Printed Page 22
line -14

"indicates they they are"
should read
"indicates that they are"

roakonam  Feb 23, 2015 
Printed Page 26
The fifth paragraph

Nothing important: a spelling error only:
The word "development" is spelled as "developemnt"

I want the book to be perfect so I will signal all tiny and perhaps more important problems as I continue reading.

Andrew Jonca  Jan 10, 2015 
Mobi, Other Digital Version Page 37%
Table 6-5

I'm using the Kindle book. In this table, the first row, second column has the following text duplicated:

"reduction function."

Kevin D'Elia  Jan 05, 2015 
Printed Page 39
first line of code

the first line of code on this page:

for (day <- res0) print(day + ", ")

refers to dynamically generated variable res0. However, on page 38 where this variable is generated, it is referred to as res10.

Gino Fortunato  Dec 25, 2019 
Mobi, Other Digital Version Page 40%
Exercises

This really has to do with the exercises for Chapter 6. I found other typos that I will list in a later errata report. Here's the one for exercise #4:

def longest(l: List[String]): String = names.sortBy(0 - _.size).head

Since names isn't defined yet, REPL barfs at this def. And, it should actually be "l", not "names", as "l" is the parameter to the function.

The other examples for this exercise also have "names" as the list val.

Side comment: I have been trying to learn Scala for a few weeks now; this book, not only because of the clear writing and organization of the material, but also because of the excellent exercises and explanations, has had the most significant positive impact on my progress. Great job, Jason!

Kevin D'Elia  Jan 05, 2015 
Other Digital Version 50%
OpenWeatherMap API example

I'm using the Kindle edition but the example is in all versions. It is also elsewhere as an example to follow in the exercises.

It looks like the API has changed and you have to sign up for a free account before you can use it. This also means you need to pass in your API key when using the API itself. It would be a simple change to update the code and explain to the reader that this would need to be done beforehand. Currently, the API responds with an Unauthorised Access error and the code never returns the Future you're demonstrating.

Steve Godrich  Nov 03, 2016 
PDF Page 70
code line annotated with "3"

val maximize is redefined by using a function literal. However, this is now allowed for 2 reasons: first, as it already exists, a second use of val generates an error. Moreover, when omitting it, since the original maximize is also a val, redefinition is not allowed.

Fix: the first maximize should be a var, and for the second, the "val" should be omotted

Anonymous  Apr 12, 2019 
ePub Page 71
1st paragraph

Typo: ...and the println was trigggered.

Anonymous  Oct 15, 2017 
Printed Page 92
Last paragraph

This is not important.
Towards the end of the page, the text explains that a map method maps the items of a list to the items of another list that "has the same size as the first."
It sounds correct, but unfortunately some of the map methods as it calls them do not seem to fit that description. In fact, in the examples coming up in the next page (p. 93), the size of the resulting lists for the collect and flatmap methods is different from the original.



roakonam  Feb 23, 2015 
PDF, ePub Page 99
Table 6-6

The description of the mkString method in table 6-6 says that it renders a collection to a set. It actually creates a string from the collection.

This MAY also be in the printed version, but I am still waiting for the copy that I have ordered, so can't check right now.

Anonymous  Jul 12, 2016 
Printed Page 111
Line 13

As the paragraph is to explain how to use a builder for a collection type, which may or may not be a Set, the term "Set" here should be replaced with something like "collection" :
"convert it back to the final Set."

roakonam  Feb 26, 2015 
Printed, PDF, ePub Page 114
Table 7-2. Sequence types

In Table 7-2. Sequence types it is written that
Queue A first-in-last-out (FIFO) list.
Well it should be
Queue A first-in-first-out (FIFO) list.

Anonymous  Aug 25, 2015 
Printed Page 139
1st paragraph

Given the following code in the book:
"""
class User(n: String) {
val name: String = n
def greet: String = s"Hello from $name"
override def toString = s"User($name)"
}
"""

The paragraph says:
"""
The class parameter "n" is used here to initialize the "name" value. However, it could not be used inside either of the methods. Class parameters are available for initializing fields (values and variables in a class) or for passing to functions, but once the class has been created the parameters aren't available.
"""

This is incorrect. Class parameters are available everywhere within the class, including in the methods it owns: greet and toString. So this does work:
"""
class User(n: String) {
def greet: String = s"Hello from $n"
override def toString = s"User($n)"
}
"""

What the author probably means is that class parameters aren't available outside (instead of inside) the class, unless they are fields:
"""
val u = new User("abc")
println(u.n) // doesn't work because its only a class parameter and not a field (without "val")
println(u.name) // does work, because its a field
"""

Jesse  Apr 11, 2016 
PDF Page 142
5nd paragraph, starts with "You can invoke a class's..."

The sentence, "This action, of reversing memory to allocate a class's contents", might be "This action, of reserving memory to allocate a class's contents".

reversing -> reserving.

sandbox wang  Jul 09, 2017 
Printed Page 157
Lines 16-19

The package syntax is nested, but probably that is not meant be here, since the nested syntax is illustrated towards the end of the page, i.e., the same code repeats there as it stands.
So the code in Lines 16 to 20 should be replaced with the one not nested, more like the one that appears in p. 160, though not exactly the same:

package com.oreilly{
class Config(val baseUrl: String = "http://localhost")
}

roakonam  Feb 26, 2015 
PDF Page 179
3rd paragraph

In the 3rd paragraph: ..., so the traits are convering an RGB ...

Should be: ..., so the traits are converting an RGB ...

The typo for "convering" to "converting".

Anonymous  Nov 30, 2015 
Printed Page 188
Bullet Point 3

The line at Bullet Point 3 should be:

"org.scalatest" %% "scalatest_2.11" % "2.2.1" % "test"

to reflect the comment on the top of next page.

Anonymous  Nov 17, 2015 
Printed Page 201

Line 10
An excess close parenthesis should be removed from:
"(1, 2, true))"

roakonam  Mar 01, 2015 
Printed Page 217
Line -8

"becuase" should read "because"

roakonam  Mar 01, 2015