Errata

Living Clojure

Errata for Living Clojure

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
Printed Page 19
2nd paragraph

Pages 19 and 21 (perhaps others) discuss "creating symbols" by means of def. This phrasing is imprecise. It is the Clojure reader that creates symbols during the process of reading S-expressions: (class (read-string "alice")) => clojure.lang.Symbol
Simply typing an S-expression that represents a symbol causes that symbol to be created by the reader, e.g., '(a b c) creates 3 symbols.
It is more accurate to say that def causes vars to be interned in a namespace, which creates a mapping from a symbol to the var.

David Sletten  Feb 15, 2021 
Printed Page 20
Multiple

The str function is used repeatedly without having yet been introduced. It is not explained until pg. 37.

David Sletten  Feb 15, 2021 
Printed Page 48
map's explanation related to side effect of println

original is written as:

(def animal-print (map #(println %) animals))
animal-print
:: mouse
:: duck
:: dodo
:: lory
:: eaglt
:: -> nil

(def animal-print (doall (map #(println %) animals))
:: -> (nil nil nil nil nil)

However, this isn't same as my environment(clojure 1.8.0):

user=> (def animal-print (map #(println %) animals))
#'user/animal-print
user=> animal-print
(:mouse
:duck
:dodo
:lory
:eaglet
nil nil nil nil nil)

user=> (def animal-print (doall (map #(println %) animals)))
:mouse
:duck
:dodo
:lory
:eaglet

user=> animal-print
(nil nil nil nil nil)

Anonymous  Feb 28, 2016 
Printed Page 50
2nd paragraph

The text states that "reduce will run until one of the input collections is empty". Unlike the map function, which will operate over multiple collections, the reduce function only operates over a single collection.

David Sletten  Feb 15, 2021 
Printed Page 57
Multiple

This page makes multiple references to the "case function". As with all operators that evaluate forms conditionally, this can not be true. Functions evaluate all of their arguments. case is a macro.

David Sletten  Feb 15, 2021 
Printed Page 66
In the middle of the page

"... and we assign an error handler with the set-error-handler-fn! function"

should be:

"... and we assign an error handler with the set-error-handler! function"

Juraj Martinka  Apr 09, 2016 
Printed Page 70
Multiple

The first Java example is puzzling. First, it's not clear what the point of calling the String constructor on a String literal is. Secondly, to make the Java more consistent with the Clojure example, wouldn't it be more straightforward to simply illustrate "caterpillar".toUpperCase()?

Additionally, the example involving indexOf() makes the confusing parenthetical comment that the method takes a character as a parameter. It's true that indexOf() is overloaded, but that is not germane to this example, which relies in both Java and Clojure on the method that accepts a String argument.

David Sletten  Feb 15, 2021 
Printed Page 73
2nd paragraph

Page 73 refers to "a function called cond", and page 87 mentions "a deftest function". Both cond and deftest are macros.

David Sletten  Feb 15, 2021 
Printed Page 106
Bottom half

In the summary of code in the core.clj file, the function random-add is mistakenly redefined. It has the two args to repeat swapped, which renders it useless for the purpose of introducing a delay to the system. This function is correct on the previous page (pg. 105).

David Sletten  Feb 15, 2021 
Printed Page 111
3rd paragraph

Under the "Creating a Web Server with Compojure" section the paragraph starts:

"Compojure is a Clojure library that provides simple routing for an another lower-lever web application library called Ring. One of nice features of Ring is that it allows...".

I think this sentence contains grammar mistakes and would make more sense in English by removing "an" before "another" and adding "the" after "one of" .

i.e. "Compojure is a Clojure library that provides simple routing for another lower-lever web application library called Ring. One of the nice features of Ring is that it allows...".

Maria Kousta  Dec 20, 2017 
Printed Page 123
2nd paragraph

The 2nd paragraph ends with:

"So, we will need to create that directory using mkdir or your operating system's equivalant method."

I think "equivalant" should be "equivalent".

Maria Kousta  Dec 22, 2017 
Printed Page 147
Multiple

There are a couple of typos on this page:
alice-phrase vs. alice-hi-queen
macro-expand-1 vs. macroexpand-1

More significantly, the macro definition for def-hi-queen has a gratuitous use of the 'symbol' function. The macro parameter 'name' is provided to the macro expansion function by the Clojure reader, which has already constructed a symbol while reading the expression:
(def-hi-queen alice-hi-queen "My name is Alice")

The 'symbol' function would only be needed if the macro were intended to be called like this:
(def-hi-queen "alice-hi-queen" "My name is Alice")
Of course, this would be a strange way to use the macro.

This criticism also applies to the version of def-hi-queen redefined on pg. 149 using backquote.

David Sletten  Feb 25, 2021 
Printed Page 149
n/a

Chapter 8 is a short chapter, and your readers can't expect you to provide complete coverage of every detail related to writing and using macros. However, it is a significant oversight that the chapter makes no mention of splicing values into macro templates via ~@.

David Sletten  Feb 25, 2021 
Printed Page 177
first paragraph

At the beginning of the page, there's a repetition which looks like a copy & paste error:
"This problem uses the thread-last macro, -->, which is much like the thread-first macro. --> is much like the thread-first macro".
The last part is repetitive, little bit confusing and should be avoided.

Juraj Martinka  Apr 29, 2016 
PDF, ePub, Mobi Page 12620
text

Typos:

"The are a couple" should be "There are a couple"

"continously" should be "continuously"

"aggresion," should be "aggression,"

Anonymous  Sep 17, 2019 
123123
Chapter 6

(defn random-add []
(reduce + (conj [] (repeat 1 (rand-int 100000)))))


The "conj" should be "into" (and, as already noted, the parameters to repeat should be swapped).

Also, how does one give a page number for the Safari online version?

Mike Albert  Jan 20, 2020