Deal of the Day

Home » Main » Manning Forums » 2009 » Clojure in Action

Thread: Excellent book; a few typos found

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 23 - Pages: 2 [ Previous | 1 2 ] - Last Post: Feb 14, 2011 12:38 PM by: limist
amitrathore

Posts: 132
From: San Mateo, CA
Registered: 10/27/09
Re: Ch.5, 5.1.4 and 5.1.6 notes
Posted: Oct 13, 2010 11:00 AM   in response to: limist in response to: limist
  Click to reply to this thread Reply

again, thanks for all the feedback, will start to incorporate everything over the next few days... you should see MEAPs with these updates in Nov.

limist

Posts: 20
Registered: 9/14/10
Ch.5.2 notes/glitches
Posted: Oct 14, 2010 12:32 PM   in response to: limist in response to: limist
  Click to reply to this thread Reply

In section 5.2.1, under "Generated classes" in the first paragraph: a colon instead of a dash would be clearer when listing the compiled classes.

But the larger issue is that the code provided here didn't work for me; I setup a top-level directory with two subdirs, classes/ and src/com/curry/utils, and placed a calculators.clj under utils/. I then tried calling (compile...) with various namespace arguments, but no luck. Not being a Java developer, I did some reading on classpath, and realized that perhaps some (semi-trivial?) steps are missing, like checking and if necessary, modifying the classpath so things work. So far, this is the only part of the book that required external referencing, perhaps pointers should be given for non-Java developers, and a mention that experience with Java is assumed.

limist

Posts: 20
Registered: 9/14/10
Ch.6, title bug
Posted: Oct 14, 2010 12:45 PM   in response to: limist in response to: limist
  Click to reply to this thread Reply

p.132 of the 9/2010 MEAP: To be consistent, the chapter 6 title should be "State and the Concurrent World" instead of "State and the concurrent world"

limist

Posts: 20
Registered: 9/14/10
Ch.6, comments/bugs, through 6.4
Posted: Oct 21, 2010 11:43 AM   in response to: limist in response to: limist
  Click to reply to this thread Reply

Opening section p.132, second paragraph, last sentence: "sometimes
worth start" should be "sometimes worth starting"

In 6.4.1, first paragraph, second sentence seems incomplete: "ref-set
is the most basic of these, it accepts a ref and a new value, and does
the needful."

The "it's" versus "its" mix-ups occur in several places in this
chapter, including in a heading.

p.143, the third paragraph begins, "Before examining commute,
let's..." would be clearer with, "Before examining the commute
function..."

Also p.143, second to last paragraph, sentence missing word: "The
reason we do it this way, however, is to ensure that see a consistent
set of users."

p.145, typo in sentence: "Instead of controlling access to data
storied on disks, inside tables and rows, STMs control access to
shared-memory." storied --> stored

Also on p.145, "In other words, any number of threads is allowed to
being the transaction." being --> begin ?

Also on p.145, "This means that even if a transaction makes changes to
multiple refs, as far as the outside world is concerned, they all
appear to happen at the same instance (when the transaction commits)."
instance --> instant ?

Under MVCC subheader, "In an MVCC system each contended (threads in
the case of Clojure) is given a snapshot of the mutable world when it
starts its transaction." Each contended what? Maybe "each contended
resource" ?

limist

Posts: 20
Registered: 9/14/10
Ch.6 comments/bugs, 6.5 onwards
Posted: Oct 28, 2010 9:36 AM   in response to: limist in response to: limist
  Click to reply to this thread Reply

******* 6.5

p.147, the example of the @ reader should be "@total-cpu-time" not "@deref"

send versus send-off: can brief examples be given of common blocking
versus non-blocking actions?

p.149, first paragraph doesn't read correctly: "As an example, if we
had agents named agent-one, agent-two and agent-three, we could cause
the current thread to block until they all actions sent to them from
the current thread (or another agent) by calling await as follows –"

p.149 missing an "of" in the second sentence here: "In order to avoid
this, Clojure also provides the await-for function. The general form
looks similar to that await, but it accepts a maximum timeout in
milliseconds –"

p.150, under the "Validations" subheader, typo in sentence fragment,
"the options allows are -" allows --> allowed

p.150, "If the validator function return false or throws an exception,
then the state of the agent is not mutated." return --> returns

Could an example of a validator function be given please?

In 6.5.3, the text refers to a write-to-database function that doesn't
appear in the (dosync...) block.

Also re. 6.5.3: this section was a bit confusing to me; the code
example is a mixture of asynchronous agent calls and a synchronous
alter call, all wrapped up in a dosync. Conceptually, it looks mildly
contradictory to mix-in agents - which are asynchronous in nature and
intent - with synchronous code. But since the point seems to be,
That's the way-to-do-it (per Hickey et. al.?) for predictable
side-effects, more examples and references would be helpful.


******* 6.6
p.152 6.6.1 first paragraph, typos: "Clojure provides several ways to update
the value of an atom. There is an important difference between atoms
and refs is that changes to one atom is independent of changes to
other atoms."

p.152, under the swap! subheader, sentence typo "use pass": "In our case above,
we could use pass swap! the addition function whenever we finish
inserting a batch of rows -"

p.153, under compare-and-set! subheader: What happens with swap! when
its internal compare-and-set! can't succeed? How many retries are
attempted?

p.154, last paragraph before 6.7: "Atoms can be used whenever there is
need for some state, but none for coordination with any other state."
Use of word "none" is a bit confusing: means no need for coordination with
any other state, right?


******* 6.7
p.154, "How let’s attempt to use a var without a root-binding –"
probably "How" --> "Now"


******* 6.8
p.156 Table 6.3, typo in the table title


******* 6.10
p.159, 6.10.2: the second line of code reads,
(def value (deref promise))
...shouldn't that be (def value (deref p))


******* 6.11
p.159 The last summary subsection has the wrong numbering, should be 6.11.

petrilli

Posts: 2
From: Arlington, VA
Registered: 7/16/10
Re: Excellent book; a few typos found
Posted: Nov 1, 2010 8:21 PM   in response to: limist in response to: limist
  Click to reply to this thread Reply

A minor nit pick as I'm reading through the last published version again.

p47 - In the discussion of quote, the wrong quote symbol is used. Instead of a straight quote, it's the grave accent, or opening quote for typographer's quotes.

rpgoldman

Posts: 26
From: US
Registered: 11/11/10
Re: Double vs. single semi-colons
Posted: Nov 14, 2010 12:04 PM   in response to: amitrathore in response to: amitrathore
  Click to reply to this thread Reply

The standard lisp convention is:

single semicolons for partial-line comments after program text

double semicolons for full-line comments embedded in code that should be indented as the code they annotate

triple semicolons for block comments.

Emacs modes typically will auto-indent according to this convention.

I think you'd be doing your readers a favor if you were to explain this convention to them and encourage them to comment in an idiomatic way, instead of having them discover it on their own. Especially if discovering it on their own involves being raked over the coals by a co-worker for bad style! ;-)

I guess I'm saying, "no, it's not a matter of personal preference," any more than proper indentation of C is a matter of personal preference (OK, there's a case where there's more than one convention, but you need to pick a convention and stick to it, or comply with the one your co-workers use.)

limist

Posts: 20
Registered: 9/14/10
Ch.7 comments/bugs
Posted: Nov 16, 2010 11:27 AM   in response to: limist in response to: limist
  Click to reply to this thread Reply

p.163, the capitalization of "the" in "7.1.2 the unless example" may
be incorrect.

In 7.1.2, "unless" should use the same (monospaced) font as "if" and
other language primitives, to distinguish it from normal text.

p.165, the bullet list of how functions execute: missing text from 3rd
bullet onwards, the paragraph following the bullet list is less clear.

p.167 7.1.4 starts, but where's 7.1.3 ?

p.170 near bottom, discussing variable capture and let, this sentence
is a bit confusing: "If Clojure didn’t expand now into a qualified
user/now (where user is the current namespace), then it might shadow
another value with the same name." Perhaps the "didn't" --> "did" ?

p.171, the auto-gensym version of the def-logged-fn macro is missing a
"#" after "now" in the (let...) expression. When this didn't work, I
had to look this up in the book "Practical Clojure" :)

p.173, 7.2.2 declare: missing an "in" in the second sentence: "The
declare macro accepts one or more symbols, in order to let Clojure
know that there may be references to them the code that follows."

p.174, 7.2.4 typo: "lightly" --> "slightly"

It may be useful to give lists of Clojure's core, and then another
list of all the language elements built on top of that core using
macros (at least for a particular version of Clojure, e.g. 1.2 or 1.3)

Overall, this chapter was great - macros have an aura of mystery
around them but this chapter explains their basics well.

limist

Posts: 20
Registered: 9/14/10
Ch.8 comments and bugs
Posted: Feb 14, 2011 12:38 PM   in response to: limist in response to: limist
  Click to reply to this thread Reply

On p.185, "In order to move past this error, we will create a new
namespace, in an appropriately located file." But it's not clear how
to setup chapter08.date-operations namespace. Need at least a note on
how to lookup what's currently on the class path, e.g.

(println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))

...and then placing a .clj file in one of the paths there of the
correct name. Relatedly, on p.186, at the sentence "Having performed
this experimentation, we can write the actual code, which finally end
[sic] up looking like:" it should be mentioned where the code actually
goes.

p.186, A link/footnote to the documentation of GregorianCalendar would
be handy:
http://download.oracle.com/javase/6/docs/api/java/util/GregorianCalendar.html

The code for adding the str-join function to the
chapter08.date-operations namespace should be provided, as I'm not
sure the (:use ...) command appeared at any point before Chapter 8.

p.193 Listing 8.1, the first (log-call...) should have the string
"fetch-all-expenses" not "fetch-all"

p.194, 8.2.2 stubbing: the first full code listing for
(deftest test-fetch-expenses-greater-than...) seems to have
indentation that's not quite accurate. At least in Emacs, the (let...)
statement is further indented, to indicate its scope within stubbing.

p.195, worth mentioning/suggesting the stubbing macro file location.

Also for the stubbing macro: partition hasn't been seen before, I
believe. And interleave has only been seen once.

By 8.2.3, there are possibly 3 files, and several different
namespaces, e.g. the first code listing in 8.2.3 introduces a new
namespace, chapter08.expense-finders-spec, which may be incorrect (and
just be chapter08.expense-finders). This is confusing. There needs
to be a preliminary discussion on how to organize the files that this
chapter will use, along with brief inline directions to create a new
file, and where to put it. It would also be helpful to have a label
of some sort for every significant code listing as to the (suggested)
file name that listing should belong to.

p.198, the updated test-filter-greater-than uses the arg all-expenses
but it has not been defined. Same issue on p.199.

p.199, the first defmacro code has different formatting than rest.

p.201, Removing global state: again, it's useful to clarify where
these new functions should go.

Overall, this chapter took a lot longer to work through than it should
because of the files naming and location issues above, and the order
of presentation. Complete code listings with filename and location
referencing would help a lot.

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor