Posts:
42
Registered:
8/26/09
|
|
|
|
v6 page 10
Posted:
Aug 24, 2011 9:05 AM
in response to:
luke.bace
|
|
1. Same as my last comment, no arg in getLines 2. Be consistent with Listing 1.1 and fully qualify package name for Source:
class FileAsIterable { val src = scala.io.Source.fromFile(new File("someFile.txt")) def iterator = src.getLines()
|
|
Posts:
41
From:
Brisbane
Registered:
11/30/10
|
|
|
|
Re: Errors and Corrections
Posted:
Aug 24, 2011 5:13 PM
in response to:
luke.bace
|
|
1.1.3 Scala as functional language Mutable versus immutable data
An object is called mutable when you can alter the contents of the object if you have a reference to it. Whereas in the case of an immutable object, the contents of the object can’t be altered if you have a reference to it.
The above should be a single sentence, separated by either a comma or a semicolon.
P4
The benefits of not having mutability and side effects in functional programs are the programs are much easier...
Should be:
The benefits of not having mutability and side effects in functional programs are that the programs are much easier...
Message was edited by: peterbwest peterbwest
|
|
Posts:
1
From:
Colombia
Registered:
8/27/11
|
|
|
Posts:
42
Registered:
8/26/09
|
|
|
|
v6, p23
Posted:
Sep 4, 2011 8:28 AM
in response to:
luke.bace
|
|
Need to explain that (_.isUpper) can optionally use parenthesis instead of curly braces because is has only one parameter.
|
|
Posts:
42
Registered:
8/26/09
|
|
|
|
Re: v6, p23
Posted:
Sep 4, 2011 9:24 AM
in response to:
jweden
|
|
Actually, I think the reason is, as you know, because it is only one expression not because it has one parameter if I am learning correctly.
|
|
Posts:
42
Registered:
8/26/09
|
|
|
|
v6, p23
Posted:
Sep 4, 2011 9:30 AM
in response to:
luke.bace
|
|
def break = new Runtime...
explain why there are no parenthesis or curly braces here around method body.
|
|
Posts:
62
Registered:
11/15/10
|
|
|
|
Re: v6, p23
Posted:
Sep 4, 2011 3:26 PM
in response to:
jweden
|
|
Meap v6, section 2.2.3, p23 (in the text)
orig: def break = new RuntimeException... must be fix: def break = throw new RuntimeException.... (see Listing 2.1 where it is done that way)
|
|
Posts:
42
Registered:
8/26/09
|
|
|
|
v6, p26 section 2.3
Posted:
Sep 4, 2011 4:49 PM
in response to:
luke.bace
|
|
v6, p26 section 2.3. Instead of:
"In this example we're adding 3..."
say:
"In the following example we're adding 3..."
This is because I kept looking for :+ in the code above and not in the code below.
Message was edited by: jweden
|
|
Posts:
42
Registered:
8/26/09
|
|
|
|
v6 LIsting 2.6 p34
Posted:
Sep 10, 2011 11:27 AM
in response to:
luke.bace
|
|
method findIndexOf in trait SeqLike is deprecated: Use indexWhere(p) instead. This is RestClient.scala in your git repo.
Message was edited by: jweden
|
|
Posts:
42
Registered:
8/26/09
|
|
|
|
V6 p36
Posted:
Sep 14, 2011 8:39 PM
in response to:
luke.bace
|
|
...result of toArray as a variable-length argument
-- you forgot the "-length", otherwise it is confusing
|
|
Posts:
42
Registered:
8/26/09
|
|
|
|
p49 section 3.6
Posted:
Sep 19, 2011 9:40 AM
in response to:
luke.bace
|
|
remove "is":
MongoDB documents are saved in a collection, and a database is consists of multiple collections.
|
|
Posts:
42
Registered:
8/26/09
|
|
|
|
Listing 3.5, page 50
Posted:
Sep 19, 2011 9:49 AM
in response to:
luke.bace
|
|
You state: "One more thing to note here is that we’re invoking the findOne or getCount method on the underlying collection without using the . operator"
Explain why. Something like: "Functions with zero or one arguments can be called without the dot and parentheses. (And remember that if the function is defined without parentheses, then the function must be called without parentheses.)"
Also you then state, "In Scala, you can invoke methods like the infix operator (+, -, and so on).". Though true, this sentence seems out of place and not related to anything here unless I am missing something. I think this sentence was meant to be put after Listing 3.6 because of the -= and += function defs.
Message was edited by: jweden
|
|
Posts:
42
Registered:
8/26/09
|
|
|
|
Listing 3.10
Posted:
Sep 21, 2011 1:33 PM
in response to:
luke.bace
|
|
(Sorry, this is not errata per-se. I'm going through my postings and realizing some of them are not errata and will try to put suggestions in another thread.)
It took me a bit to understand what you are referring to here:
"When it comes to overload methods (methods with the same name), you have to specify the return type; otherwise, the code won’t compile. We have a similar limitation for recursive method calls. Scala type inference can’t infer the type of recursive methods or functions."
Recommend instead:
"When it comes to overloaded methods (methods with the same name), you have to specify the return type; otherwise, the code won’t compile. This is why we specify the DBCursor return type for the find function above. We have a similar limitation for recursive method calls. Scala type inference can’t infer the type of recursive methods or functions which is why we need to specify the DBCursor return type for the applyOptions function above."
Message was edited by: jweden
Message was edited by: jweden
|
|
Posts:
42
Registered:
8/26/09
|
|
|
|
Section 3.9
Posted:
Sep 21, 2011 2:55 PM
in response to:
luke.bace
|
|
To make things more clear, change code line from: "trait AngryMood extends DogMood {"
to:
"//WILL NOT COMPILE trait AngryMood extends DogMood {"
|
|
Posts:
42
Registered:
8/26/09
|
|
|
|
meap v6 Section 4.1.1.
Posted:
Sep 23, 2011 8:24 AM
in response to:
luke.bace
|
|
Change from:
"Maybe the class is a covariant"
to
"The Maybe class is a covariant"
|
|
|
Legend
|
|
Gold: 300
+
pts
|
|
Silver: 100
- 299
pts
|
|
Bronze: 25
- 99
pts
|
|
Manning Author
|
|
Manning Staff
|
|