small medium large xlarge

Errata for Programming Clojure

 

The latest version of the book is P3.0, released about 6 years ago. If you've bought a PDF of the book and would like to upgrade it to this version (for free), visit your home page.

By default this page displays the errata for the latest version of the book. If you have a previous version, select it here:

If you've found a new error, please submit it.

  • Typo
  • Tech. error
  • Suggestion
  • Maybe next edition
  • Not a problem
  • Reported in: P2.0 (08-Nov-09)
#41259
Paper page: Title
The "Version of Book With Error" combo box on the "Add Erratum for Programming Clojure" webpage (i.e. the page I am filling this out on) states that t...more...
  • Reported in: P3.0 (25-Jul-10)
#44272
PDF page: 27
This is about "cond". I got the impression that Clojure supports the Common Lisp cond form (with parentheses). But when I tried typing the example cod...more...
  • Reported in: P3.0 (07-Sep-10)
#44902
PDF page: 36

The if in a comment block is colored.

  • Reported in: P3.0 (01-Aug-11)
#47328
PDF page: 38
The example near the top of the page is (take 10 examples.introduction/fibs). The actual expression should be (take 10 (examples.introduction/fibs)).-...more...
  • Reported in: P3.0 (01-Aug-11)
#47329
PDF page: 38
Sorry. The other examples using fibs on this page are also incorrect. The text on the pages is (take 10 fibs). The example should be (take 10 (fibs...more...
  • Reported in: P1.0 (20-Mar-11)
#46622
Paper page: 39

For for anonymous function using implicit parameter names is "(#body)". Should be "#(body)".--Havvy

  • Reported in: P2.0 (25-Oct-10)
#45434
Paper page: 39
In the first anonymous fn example, "A fine day" string is used. Instead, to be consistent with other examples nearby, "A fine day it is" ought to be ...more...
  • Reported in: P3.0 (01-Aug-11)
#47330
PDF page: 39
The example near the bottom of the page defines the function "hello" in the namespace examples.introduction. This function was also defined on page 36...more...
  • Reported in: P3.0 (01-Aug-11)
#47331
PDF page: 40

I believe the "source" function is now defined is clojure.repl.--Larry Jones

  • Reported in: P3.0 (17-Jul-11)
#47268
PDF page: 41

(show java.util.HashMap) did not work--Steven Schermerhorn

  • Reported in: P1.0 (07-Dec-09)
  • Fixed: 19-Jul-10, awaiting book release
#41743
Paper page: 52

In the definition of index-filter, what is the purpose of the outer when? --Vraj Mohan

Stuart Halloway says: Prevent NullPointerExceptions when passed nil.
  • Reported in: P1.0 (23-Dec-10)
#46099
Paper page: 52
In the second example of the use of index-filter: (index-filter #{\a \b} "xyz") should the return value be "()" (an empty list) instead of "nil"...more...
  • Reported in: P2.0 (03-Dec-09)
  • Fixed: 19-Jul-10, awaiting book release
#41693
Paper page: 52
This may be a misunderstanding on my part, but for the code example: [code] (defn index-filter [pred coll] (when pred (for [[idx elt] (in...more...
Stuart Halloway says: I believe the existing text is simple and accurate.
  • Reported in: P3.0 (02-Aug-11)
#47336
PDF page: 57
On page 56, we define the function "greeting" in the file exploring.clj. On page 57, we redefine the function "greeting" to accept multiple arguments....more...
  • Reported in: P3.0 (02-Aug-11)
#47337
PDF page: 59
On page 58, we define "indexable-words?" as a top-level function. On page 59, we reuse that name but bind it to a locally defined function. A footn...more...
  • Reported in: P3.0 (11-Aug-11)
#47362
Paper page: 73
On page 73, we define a function named describe-class. This function clashes with the version defined on the previous page. If we want to maintain bot...more...
  • Reported in: P2.0 (16-Feb-10)
  • Fixed: 19-Jul-10, awaiting book release
#42316
PDF page: 74
The phrase, metadata is "data about data", is technically incorrect. Although it is more common in English to do so, the preferred is still to treat ...more...
Stuart Halloway says: Author's choice.
  • Reported in: P3.0 (12-Oct-10)
#45354
PDF page: 75
The metadata reader macros described have been deprecated with the release of Clojure 1.2 -- '^' is now used to attach metadata to objects (with a sho...more...
  • Reported in: P3.0 (11-Aug-11)
#47364
Paper page: 78
On page 77, we provide sample code for reader/tasklist.clj. On page 78, we then shift to example/tasklist.clj. For several minutes, I thought these we...more...
  • Reported in: P3.0 (11-Aug-11)
#47365
Paper page: 84

We define class-available? near the middle of the page and then we redefine it a paragraph later.--Larry Jones

  • Reported in: P2.0 (27-Oct-11)
#47832
PDF page: 92
Code example at bottom of page reads: (parse (java.io.File. "examples/sequences/compositions.xml")) However, the proper path to compositions.xml...more...
  • Reported in: P3.0 (23-Nov-10)
#45731
PDF page: 97

The text states, "The interesting part is the :gen-classform...."

I believe it should read ":gen-class form".
--Larry Jones

  • Reported in: P3.0 (14-Aug-11)
#47381
Paper page: 106
On this page, we define the symbol x twice. When I was first entering this data myself, I did not (since I'd just defined x). When I entered the funct...more...
  • Reported in: P3.0 (22-Jun-11)
#47213
PDF page: 122
It says: "To see a non-true match, try using some with identity to find the first non-nil value in a sequence: (some identity [nil false 1 nil 2]) ⇒...more...
  • Reported in: P3.0 (23-Jun-11)
#47215
PDF page: 153
Unsure if my previous attempt to submit this worked as it complained about use of a hyperlink. There's a problem with the typesetting of the kindle ve...more...
  • Reported in: P2.0 (22-Feb-11)
#46442
PDF page: 171
Paper page: 151
Under subheading, "Replacing Recursion with Laziness," (replace '((a b) (((b g r) (f r)) c (d e)) b) 'b 'a) is shown to be returning: ((a a) ...more...
  • Reported in: P1.0 (10-Nov-09)
  • Fixed: 19-Jul-10, awaiting book release
#41296
Paper page: 189

Line 8 of the runonce code has a nil that looks like it can be omitted.--art gittleman

Stuart Halloway says: Returning nil prevents reset-fn from exposing implementation details.
  • Reported in: P3.0 (31-Aug-11)
#47473
Paper page: 203
When I tried the examples on this page, the Clojure repl reported an error: user=> (let [a 1 b 2] (broken-bench (+ a b))) java.lang.Exception: Can...more...
  • Reported in: P2.0 (19-Nov-09)
  • Fixed: 19-Jul-10, awaiting book release
#41574
PDF page: 208
The definition of println-once should be (def println-once (create-runonce println)) as in was in the first printing assuming the code for runonce i...more...
Stuart Halloway says: This is not a problem once #41579 is fixed. Thanks!
  • Reported in: P2.0 (14-Nov-09)
  • Fixed: 19-Jul-10, awaiting book release
#41428
PDF page: 208

(function) should be (apply function args)
This was reported for v. 1.0 but not yet corrected.--art gittleman

Stuart Halloway says: This is not a problem once #41579 is fixed. Thanks!
  • Reported in: P2.0 (10-Nov-09)
  • Fixed: 19-Jul-10, awaiting book release
#41297
PDF page: 209

line 8 of the runonce code has a nil that could be omitted.--art gittleman

Stuart Halloway says: Returning nil prevents reset-fn from exposing implementation details.
  • Reported in: P2.0 (19-Nov-09)
  • Fixed: 19-Jul-10, awaiting book release
#41568
PDF page: 223
Paper page: 203
The example shows what would happen if Clojure allowed unqualified symbols "start" and "result" in a macro. The example continues with "start" being b...more...
Stuart Halloway says: The macro trumps the let binding, not the other way around. Try it and see.
  • Reported in: P2.0 (26-Oct-09)
#41111
PDF page: 223
When talking about auto-gensym, the "try it" example is `foo#. The font in the PDF makes this appear like 'foo#. Copying gives the correct backtick,...more...
  • Reported in: P3.0 (10-Oct-10)
#45328
PDF page: 236

A normal quote is used in the first listing of deftarget rather than a back-quote.--Dale Thatcher

Stuff To Be Considered in the Next Edition

  • Reported in: P1.0 (19-Oct-09)
#41023
Paper page: 23

In
(use 'lancet)
where is lancet? The code does not load as is.
Also 'lancet.ant.
--art gittleman

Stuart Halloway says: This example code showing lancet usage is not intended to be run at this point in the book. To see where lancet has gone since the book has been published, see http://github.com/technomancy/leiningen
  • Reported in: P2.0 (17-Dec-09)
#41857
PDF page: 31
The remark about "following the *nix instructions" for Cygwin is not accurate. From a Cygwin shell, the repl.sh script does not work. You must change ...more...
  • Reported in: P1.0 (20-Sep-09)
#40813
PDF page: 36
In the example of redefining the hello function to be hello-with-memory, the text says you can verify the new functionality by typing (hello "Rich") a...more...
Stuart Halloway says: This is a good point for the next edition.