The Artima Developer Community
Sponsored Link

Programming in Scala Forum
Possible mistakes in chapters 5 to 8

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eric Willigers

Posts: 8
Nickname: ewilligers
Registered: Dec, 2007

Possible mistakes in chapters 5 to 8 Posted: Jan 30, 2008 3:29 AM
Reply to this message Reply
Advertisement
p99
"To help with this common situation, the String class includes a method call stripMargin."

This is misleading: stripMargin is not defined in java.lang.String

Perhaps have
"To help with this common situation, Scala provides a method called stripMargin."


p108
The Int -2 has 32 bits not 30.
(111111111111111111111111111110)
should be
(11111111111111111111111111111110)


p111
(already picked up by Erik Ekman)
operatorsm
should be
operators



"on Scala’s basic types include than"
should be
"on Scala’s basic types than"


p112
(already spotted by sbelur)
"-2.7 abs 2.5"
should be
"-2.7 abs 2.7"


Table 5.5: Rich Wrapper Classes
omitted
Long scala.runtime.RichLong


p113
"As a fucntional language,"
should be
"As a functional language,"


(subjective)
"A simple example are rational numbers."
This mixes singular and plural poorly.
How about
"Rational numbers provide a simple example."


"x is called the numerator or the fraction"
should be
"x is called the numerator of the fraction"

", or 2/1."
should be
", and 2/1."


p118
(subjective)
I found
"since now numbers display correctly"
difficult to read. An alternative is
"since numbers now display correctly"


p119
(already reported by Carsten)
private val g = gcd(x, y)
should be
private val g = gcd(n, d)


p121
(subjective)
"but this would be not as legible."
should be
"but this would not be as legible."


p122
"the 7 Bit ASCII characters which are not letters, digits, or one of"

You've left out whitespace and unprintable characters. Here's an alternative:

"the printable 7 Bit ASCII characters which are not letters, digits, whitespace, or one of"

printable/unprintable isn't all that important here, but I think whitespace is.


p126
"how define operators as methods"
should be
"how to define operators as methods"


p127
"those few control structure that are built in."
should be
"those few control structures that are built in."


p129
"Recall this example from gcdLoop in Chapter 4:"
Chapter 4 does not contain gcdLoop. Perhaps it did in an earlier version?

p130
"Scala’s for expression is a Swiss army knife of enumeration. Based on a
construct called the for expression,"

So Scala's for expression is based on the for expression?

Perhaps:

"Scala’s for expression is a Swiss army knife of enumeration. Using a for expression, Scala lets you ..."


(subjective)
In section 7.3 do you want the "for" in "for expression" to be in the font for code? Sometimes it is, sometimes it isn't.


p131
"You can do this with a for expression by adding a semicolon plus an if clause to your for expression."
should be
"You can do this with a for expression by adding an if clause to your for expression."


<justification>

The language spec and the compiler confirm the semicolon is optional:-

Generator ::= Pattern1 ‘<-’ Expr [Guard]
Guard ::= ‘if’ PostfixExpr

for (file <- filesHere if file.getName.endsWith(".scala"))
println(file)

p132 does already say "As usual inside {} brackets, it is not necessary to
put semicolons at the ends of lines." but that doesn't cover the case above where the if guard isn't on a new line.

No need to change the example.

</justification>


p139
"Every variable, type class, or other declaration"
should be
"Every variable, type, class, or other declaration"


"or a field selection (foo.bar)."
should be
"or a member selection (foo.bar)."
because it might be a type or method


p147
"anonynmous"
should be
"anonymous"


p152
"partially applied function are considered"
should be
"partially applied functions are considered"


p161
"a while-look"
should be
"a while-loop"


p165
"(If you don’t fully grok tail recursion yet, see Section 8.7)."
Not needed: we are already in Section 8.7


p166
"build-in"
should be
"built-in"

Topic: Please make the list of suggestion browseable Previous Topic   Next Topic Topic: Please add some code with Mutidimensional arrays

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use