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. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
ePub
Chapter 7. Creating Web Applications with Clojure

In "Browser-Connected REPL" section, there's a typo.

Original: We can do this will a couple code changes in our core.cljs file.
Suggestion: We can do this with a couple code changes in our core.cljs file.

Note from the Author or Editor:
Should be:

We can do this with a couple code changes in our core.cljs file.

Anonymous  Jul 26, 2015  Feb 05, 2016
PDF
Page x
3rd paragraph

Text is, "this book built around"; should be "this book is built around".

Note from the Author or Editor:
should be "this book is built around".

Wil Cooley  Feb 27, 2015  Feb 05, 2016
Printed
Page 20
2nd paragraph from bottom

Original: "If there is one parameter, you can you the percent sign ..."

Should it be: "If there is one parameter, you can use the percent sign ..."

i.e., change the 2nd 'you' to 'use'?

Note from the Author or Editor:
good catch.
Should it be: "If there is one parameter, you can use the percent sign ..."

Anonymous  Nov 20, 2015  Feb 05, 2016
PDF
Page 21
2nd paragraph, 2nd sentence

In "There are three mains ways of using libs in your namespace", "mains" should be "main"

Note from the Author or Editor:
mains should be replaced by main

Anonymous  May 06, 2015  Feb 05, 2016
PDF, Mobi
Page 21
Last sentence

If there is one parameter you can you the % sign to represent it.
->
If there is one parameter you can use the % sign to represent it.

Note from the Author or Editor:
should be
If there is one parameter you can use the % sign to represent it.

Andrew Vida  Apr 08, 2015  Feb 05, 2016
PDF
Page 26
1st paragraph

The sentence

It differs from an expression in that it specifies a correct syntax by being valid.

is a duplicate from the last paragraph on the previous page.

Note from the Author or Editor:
It differs from an expression
in that it specifies a correct syntax by being valid. And this is a valid form
because its syntax is correct and it runs without errors

should be changed to:

This is a form because its syntax is correct and it runs without errors

Anonymous  Aug 05, 2015  Feb 05, 2016
ePub
Page 29
3rd Paragraph Tip box

“TIP
Commas are ignored in Clojure. Leave them behind, and use spaces to seperate your elements in a collection.


Excerpt From: Carin Meier. “Living Clojure.” iBooks.

separate should be separate

Anonymous  Apr 23, 2015  Feb 05, 2016
Printed
Page 32
bulleted list, first item

The function empty? is misspelled as emtpy?

"Test to see if a collection is empty with emtpy?"
should be:
"Test to see if a collection is empty with empty?"

Note from the Author or Editor:
correct

"Test to see if a collection is empty with emtpy?"
should be:
"Test to see if a collection is empty with empty?"

Matthew Lawhead  Jul 25, 2015  Feb 05, 2016
Printed
Page 37
1st paragraph

Typo in last sentence of 1st paragraph.

"It will use str, which takes arguments and returns the concatenated string of them to construct a sentence of the how the person is growing:"

There's an extra 'the' as the 6th to last word in that sentence. It should be:

"It will use str, which takes arguments and returns the concatenated string of them to construct a sentence of how the person is growing:"

Note from the Author or Editor:
correct

"It will use str, which takes arguments and returns the concatenated string of them to construct a sentence of the how the person is growing:"

should be:

"It will use str, which takes arguments and returns the concatenated string of them to construct a sentence of how the person is growing:"

David Snyder  Jul 25, 2015  Feb 05, 2016
PDF, Mobi
Page 38
Note

"Currying is not tasty dish, but a way to generate a new function with an argument partially applied."
-> "Currying is not a tasty dish, but a way to generate a new function with an argument partially applied."

Note from the Author or Editor:
should be changed to
"Currying is not a tasty dish, but a way to generate a new function with an argument partially applied."

Andrew Vida  Apr 08, 2015  Apr 09, 2015
Printed
Page 42
5th para beginning "The result is not..."

The repeatedly function is used to start a sentence in this paragraph, and incorrectly has its initial letter capitalised.

Note from the Author or Editor:
correct. repeatedly should be lowercase

Anonymous  May 12, 2015  Feb 05, 2016
PDF
Page 57
Line 2

'It indeed got udpated'

Note from the Author or Editor:
should be
It did indeed get updated

Rowan Limb  Mar 03, 2015  Apr 09, 2015
Printed
Page 64
line 2

We give it an initial state with an @:
Isn't the "with an @" unnecessary? or, "with :caterpillar"?

Note from the Author or Editor:
"We give it an initial state with an @:"

should be changed to

"We give it an initial state with a parameter:

yoyo  Jul 17, 2015  Feb 05, 2016
Printed
Page 72
The very last entry in the Clojure code

Page 72 (Ch. 4) there is a table explaining Java-Clojure interop.

The very last entry in the Clojure code is:

(.getHostName host))

There is an extra right bracket in that piece of code.

Note from the Author or Editor:
extra bracket should be removed
(.getHostName host)

Anonymous  Jan 22, 2016  Feb 05, 2016
Printed, Other Digital Version
Page 75
Bottom third of page

Text: First, we declare that the function named eat-mushroom is going to be a multimethod with def-multi.

Should be just defmulti (no dash)?

Note from the Author or Editor:
correct it should be defmulti instead of def-multi

Shane Essary  Aug 23, 2015  Feb 05, 2016
Printed
Page 76
2nd code example

Second coding example: In between REPL calls, author writes "Likewise, when we call it will a big height, it will tell us the hint to shrink.", should be "Likewise, when we call it with a big height ... "

Note from the Author or Editor:
should be "Likewise, when we call it with a big height ... "

Nicholas Corneau  Jan 25, 2016  Feb 05, 2016
Printed
Page 86
Directory tree diagram

The tree of layout of the project incorrectly lists core.clj in the src/serpent_talk dir. It should be talk.clj.

Note from the Author or Editor:
Correct. core.clj should be replaced with talk.clj

Anonymous  May 24, 2015  Feb 05, 2016
Printed
Page 88
mid-page

Type in the following to run the tests:
-> **lein test**

looks like some markdown formatting, should just be -> lein test

Note from the Author or Editor:
That is correct. it should be ->lein test

Shane Essary  Aug 22, 2015  Feb 05, 2016
Printed
Page 90
right middle of the page

"group-id identifies a project uniquely across all projects, like a domain name."

does the "project" should be "group" or "organization"?

Note from the Author or Editor:
it should be changed from "group-id identifies a project uniquely across all projects, like a domain name."

to
"group-id identifies a entity uniquely across all projects, like a domain name."

yoyo  Jul 16, 2015  Feb 05, 2016
Printed
Page 97
L-2

as we look at a using ... -> as we look at and using ...

Note from the Author or Editor:
"in the next chapter as we look at a using a really powerful library"
should be changed to
"in the next chapter as we look at using a really powerful library"

yoyo  Jul 17, 2015  Feb 05, 2016
Printed
Page 105
Second code listing

The text explains: "Then it uses a function that will sum up a vector filled with the number 1 of a random length", but the code: (repeat 1 (rand-int 100000)) produces a single instance of a random number, not a random number of instances of the number 1. It should be (repeat (rand-int 100000) 1)

Note from the Author or Editor:
correct - should be changed to (repeat (rand-int 100000) 1)

Michael Monette  Jun 24, 2015  Feb 05, 2016
Printed
Page 107
2nd Paragraph under "Creating a Tea Party..." heading

Text says "result of the fatest tea web service"; should be "result of the fastest tea web service".

Note from the Author or Editor:
Text says "result of the fatest tea web service"; should be "result of the fastest tea web service".

Michael Monette  Jun 24, 2015  Feb 05, 2016
PDF
Page 111
1st paragraph

I love the book, but it is extremely frustrating, to have to try and figure out the reasons for errors in the Web Development chapters, without complete source code to refer to.

For example, if an event doesn't work, and we look through the code and the book for hours and eventually days, we can't find out whether it's a spelling error, a server error, or what not.

Perhaps in a subsequent next version, the author can forward a link to the entire source code, and confirm that it's complete (meaning, that it has the actual clojure code, and not merely the html files), before she publishes.

Note from the Author or Editor:
Good point. The source for the example is here https://github.com/gigasquid/cheshire-cat.

In the next edition, a link will be provided.

ClojureExplorer  Aug 30, 2015  Feb 05, 2016
Printed
Page 112
Directory Listing

└── test
└── cheshire_cat
└── test
└── handler.clj

Should the test/cheshire_cat/test exist here?

Note from the Author or Editor:
it should be

── test
└── cheshire_cat
└── handler_test.clj

yoyo  Jul 27, 2015  Feb 05, 2016
Printed
Page 115
handle.clj

Let’s look at the src/cheshire_cat/handler.clj file:
(ns cheshire-cat.core.handler
...

The namespace "cheshire-cat.core" doesn't match the file's directory structure, for the "core" directory doesn't exist.

Note from the Author or Editor:
correct it should be

(ns cheshire-cat.handler

yoyo  Jul 27, 2015  Feb 05, 2016
Printed
Page 119
middle-bottom

I didn't get the Content-Type set to "application/json" correctly. After I swapped the route wrappers, it worked for me.
What I done is changed following:
(-> app-routes
(ring-json/wrap-json-response)
(wrap-defaults site-defaults))
to:
(-> app-routes
(wrap-defaults site-defaults)
(ring-json/wrap-json-response))

Note from the Author or Editor:
After some digging with some other people that have encountered the problem. It seems to be the order of the app-routes.

They should be:

(def app
(-> app-routes
(ring-json/wrap-json-response)
(wrap-defaults site-defaults))) on pg 119

instead of

(def app
(-> app-routes
(wrap-defaults site-defaults)
(ring-json/wrap-json-response)))


Later on in the whole code for the handler.clj file it is correct.

yoyo  Jul 23, 2015  Feb 05, 2016
Printed
Page 120
last quarter of page

:plugins [[lein-ring "0.8.12"]...
next page on 121 has:
:plugins [[lein-ring "0.8.13"]...

Note from the Author or Editor:
should be 0.8.13

Shane Essary  Aug 26, 2015  Feb 05, 2016
Printed
Page 127
2nd paragraph

Text: For that, we'll need the ClojureScript HTTP library cljs-https.

Next paragraph, we use the library cljs-http

Note from the Author or Editor:
should be cljs-http

Shane Essary  Aug 26, 2015  Feb 05, 2016
Printed
Page 129
2nd paragraph

After adding line to project.clj code listing, instructions are to: Also remember to restart your cljsbuild. Shouldn't this be to restart the lein ring server to grab enfocus library?

Note from the Author or Editor:
The cljsbuild is the one that needs it to generate the JavaScript. The lein process also uses dependencies as well, but doesn't need it for this case.

In the future editions, a sentence or two should be called out to explain the difference.

Shane Essary  Aug 26, 2015 
PDF, ePub
Page 134
end of code sample at top of page

On the last line of the code sample, `say-goodbye` is wired up for the `:click` event for `#button1` using an anonymous function literal: `#(say-goodbye)`; the anonymous function literal is unnecessary here -- the `say-goodbye` function itself is sufficient for the argument. UUO#()

Note from the Author or Editor:
The last line of code at the top of the page should be say-goodbye instead of #(say-goodbye)

willcooley  May 04, 2015  Feb 05, 2016
Printed
Page 158
last para.

Text is "how may people are using the reduce function", "how may" should be "how many"

Note from the Author or Editor:
correct
"how may people are using the reduce function", "how may" should be "how many"

yoyo  Jul 23, 2015  Feb 05, 2016
Printed
Page 184
bottom paragraph, second sentence

"Given a positive integer n, return a function (f x) which computes xn." should be "Given a positive integer n, return a function (f x) which computes x raised to the power n."

Note from the Author or Editor:
Good catch - should be

Given a positive integer n, return a function (f x) which computes x raised to the power n."

Bill Schneider  Nov 21, 2015  Feb 05, 2016
ePub
Page 341-342
The code snippet

Just for reference, I am reading this in iBooks

Before I get onto the problem I found, I love this book. The approach, what others might refer to hand-holding, is very much appreciated, and it has renewed my interest and commitment to spending real time with clojure.

The problem I ran into was that the body that is returned from the response (:body response) I am pretty sure is still just a string, and has not been turned into a clojure map. I have not figured out how to get the clojurescript repl working and to poke around in it, but with trial and error and trying not to add a new dependency I managed to get this to work with this code:

(ns cheshire-cat.core
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [clojure.browser.repl :as repl]
[cljs-http.client :as http]
[cljs-http.util :as util] ;; this is added for decoding json
[cljs.core.async :refer [<!]]
[enfocus.core :as ef]))

(enable-console-print!)

;; (println "Hello World!")

;; (.log js/console "Try this!")

(defn ^:export init []
(println "I am about to start listening!")
(repl/connect "http://localhost:9000/repl")
(go
(let [response (<! (http/get "/cheshire-cat"))
body (util/json-decode (:body response))] ;; use util/json-decode to turn the body into a clojure map, so we can refer to the attributes
(println response)
(println body)
(println (:name body)) ;; it works!!
(println (:status body)) ;; again it works!! :)
(ef/at "#cat-name" (ef/content (:name body)))
(ef/at "#status" (ef/content (:status body)))
)))

Again, thanks again for writing this book, and the approach you have taken (I am assuming this will be read by Ms. Meier), and I am looking forward to getting the the 8 week plan part, and enjoying the ride there.

Note from the Author or Editor:
After some digging with some other people that have encountered the problem. It seems to be the order of the app-routes.

They should be:

(def app
(-> app-routes
(ring-json/wrap-json-response)
(wrap-defaults site-defaults))) on pg 119

instead of

(def app
(-> app-routes
(wrap-defaults site-defaults)
(ring-json/wrap-json-response)))


Later on in the whole code for the handler.clj file it is correct.

Rohan Nicholls  Apr 29, 2015  Feb 05, 2016