Chapter 9 - Errata

typo / grammar, in section about sets:

“You can also use the in to check for existence:”

either remove “the” or specify adjective after in such as “operator”

In the Challenges section, for this one:

“Declare a function occurrencesOfCharacters that calculates which characters occur in a string…”

This part of the question and solution, doesn’t make any sense:

val count = map.getOrDefault(c, defaultValue = 0)

Where the “orDefault” has zero bearing on the question, or the solution. The reason being, the function does NOT return the occurrence of every letter in the alphabet. It only returns the number of occurrences of letters that exist in the string. Therefore, no character will ever occur less than one time and the default clause has no bearing.

Instead, if they want to provide the bonus situation, they should have the function return the number of occurrences of every letter of the alphabet. But also, this seems totally unnecessary since, if a letter is not listed in the original case, that means it has zero occurrences.

@abunur Thank you for the heads up - much appreciated! I will forward this to the book team.