small medium large xlarge

Errata for Programming Clojure (2nd edition)

 

The latest version of the book is P2.0, released 10 months 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: B1.0 (22-Sep-11)
#47623
PDF page: All
My ebook reader on android (aldiko) can't import the epub version into my library, because some information seems to be set like in the first edition....more...
  • Reported in: P1.0 (16-Jan-16)
#79642
PDF page: Safri
(I'm viewing P1.0 on O'Reilly Safari, so I don't know what page number this error is on.) The "Recursion Revisited" section has an initial trampoli...more...
  • Reported in: P1.0 (20-Jan-16)
#79669
PDF page: Safri
(I'm viewing P1.0 on O'Reilly Safari, so I don't know what page number this error is on.) The "Including Agents in Transactions" sub-section of cha...more...
  • Reported in: P1.0 (30-Dec-12)
#50423
PDF page: N/A

.mobi version of the file does not contain index.--Hiro Asari

  • Reported in: P1.0 (15-Aug-12)
#49674
Paper page: xxi

I would lighten up the grey used in the background blocks, for readability.--Rich Morin

  • Reported in: P1.0 (15-Aug-12)
#49657
Paper page: xxii

A newline is needed between "... with namespace prompt" and "-> 4 ...".--Rich Morin

  • Reported in: B3.0 (21-Nov-11)
#47996
PDF page: 1

The cover on the epub version on page 1 on the nook touch is not scaled to the visible area of the nook.--Steven Proctor

  • Reported in: P1.0 (18-Apr-12)
#49131
PDF page: 1
The ebook reader on my Android tablet shows an incorrect thumbnail, it shows "SQL Antipatterns", i.e. images/_covers/bksqla.jpg (the 1st within that d...more...
  • Reported in: P1.0 (20-Jul-12)
#49545
PDF page: 4
In the description of how the Clojure function blank? works, you don't describe what it does with an empty string. It seems obvious that if every cha...more...
  • Reported in: P1.0 (15-Aug-12)
#49664
Paper page: 7

I would indent the lines beginning "((> x ..." and "(> x ...".--Rich Morin

  • Reported in: P1.0 (15-Aug-12)
#49658
Paper page: 9
The sentence beginning "Clojure provides a ..." contains four instances of a superfluous space following an opening parenthesis, eg: "( on page 115)"....more...
  • Reported in: B5.0 (11-Mar-12)
#48926
PDF page: 10
In the book it states, "...but notice that in the following code the Clojure version has both fewer dots and fewer parentheses than the Java version: ...more...
  • Reported in: P1.0 (21-Apr-13)
#51355
PDF page: 10
In: "but notice that in the following code the Clojure version has both fewer dots and fewer parentheses than the Java version: // Java "hello"...more...
  • Reported in: B4.0 (06-Jan-12)
#48471
PDF page: 15
The hello user with memory example is incomplete and so is the associated source code. It seemed fine in the previous release (i.e. b3).--David Sweene...more...
  • Reported in: B5.0 (30-Mar-12)
#49035
PDF page: 16
Link for the Github Repo in the footnote probably isn't the up to date code. Please update it with the latest or totally remove it. Wasted an hour on ...more...
  • Reported in: B3.0 (21-Nov-11)
#47997
PDF page: 17

In the epub version on the nook touch, footnotes 3 and 4 on page 17 do not have the full url it stops after the "//".--Steven Proctor

  • Reported in: P1.0 (15-Aug-12)
#49662
Paper page: 24

I would change "... for the dividend." to "... for the dividend or the divisor.".--Rich Morin

  • Reported in: P1.0 (15-Aug-12)
#49663
Paper page: 25

The word "Namespaces" should be hyphenated as "Name-spaces", rather than "Names-paces".--Rich Morin

  • Reported in: B3.0 (20-Nov-11)
#47991
PDF page: 26
URLs in footnotes (as on this page, but there are others) are missing the ':' after 'http'. The linked URL itself is correct, i.e. the hyperlink works...more...
Aaron and Stuart says: What version are you using? I don't see this in the pdf version.
  • Reported in: B5.0 (02-Mar-12)
#48863
PDF page: 29
Where is says “To run Clojure and the code in this book, you need two things:” I think it would be beneficial to say you need 3 things instead, with ...more...
  • Reported in: P1.0 (22-Oct-12)
#49978
PDF page: 30
Instantiating the record, (->Book "title" "author"), returns an error: "java.lang.Exception: Unable to resolve symbol: ->Book in this context" Inst...more...
  • Reported in: P1.0 (15-Aug-12)
#49661
Paper page: 30
The period (just before the colon) in "... a record with user.Book.:" seems out of place and is confusing. Please change and/or explain this.--Rich Mo...more...
  • Reported in: P1.0 (22-Nov-13)
#53192
Paper page: 31

Add index entry for #() anonymous-function notation--Phill

  • Reported in: P1.0 (22-Nov-13)
#53193
Paper page: 31

Add index entry for #"" regular-expression notation--Phill

  • Reported in: B4.0 (21-Feb-12)
#48793
PDF page: 32
I also tested the code and the following does not work (defrecord Book [title author]) (->Book "title" "author") I then tried the following and i...more...
  • Reported in: P1.0 (15-Aug-12)
#49659
Paper page: 36
In the section "When to Use Anonymous Functions", I'd like to see some discussion of the benefits of named functions (eg, decomposition of code, docum...more...
  • Reported in: P1.0 (15-Aug-12)
#49660
Paper page: 37

Change "... the var bound to ..." to "... the var that is bound to ...".--Rich Morin

  • Reported in: P1.0 (14-Nov-13)
#53150
PDF page: 40
for destructuring forms, the ref to the `let` doc is misleading,since currently the special_forms documentation has a specific "Binding Forms (Destruc...more...
  • Reported in: P1.0 (15-Aug-12)
#49665
Paper page: 42

The word "namespace" should be hyphenated as "name-space", rather than "names-pace".--Rich Morin

  • Reported in: B1.0 (16-Sep-11)
#47585
PDF page: 42
Found another instance of a "word" being highlighted as if it were a function when it isn't being referenced as one in the require form just prior to ...more...
Aaron and Stuart says: This is a case where str is a function in clojure.core and the clojure mode highlighting is picking that up. I'll see if they can add a case for this in the syntax highlighter.
  • Reported in: P1.0 (15-Aug-12)
#49666
Paper page: 43

In "... into a Clojure Var:", I do not think "Var" should be in monospace font, nor that the "v" should be capitalized.--Rich Morin

  • Reported in: P1.0 (15-Aug-12)
#49667
Paper page: 43

It would be useful to clarify that nextInt is a _Java_ method, eg: "The . can call Java methods."--Rich Morin

  • Reported in: P1.0 (15-Aug-12)
#49668
Paper page: 45

I would expand "... from REPL when exploring." to "... from the REPL when you are exploring."--Rich Morin

  • Reported in: P1.0 (15-Aug-12)
#49669
Paper page: 45
The sentence "If the first argument to if is logically false, it returns nil:" is a bit awkward and potentially confusing. How about changing "it" to ...more...
  • Reported in: P1.0 (15-Aug-12)
#49670
Paper page: 46
"The Swiss Army knife of flow control in Clojure is loop:" seems awkward. How about "loop is the Swiss Army knife of flow control in Clojure:"?--Rich ...more...
  • Reported in: B3.0 (22-Nov-11)
#48010
PDF page: 48
In the epub version on the nook touch, Table 1, the underline of "Using Numeric Types" for the link is not under that part of the text, but spans the ...more...
  • Reported in: B3.0 (01-Dec-11)
#48099
PDF page: 48
Can't turn past page 48 on the kobo ebook reader. Crashes the reader and forces a reboot. If I go to page 100, and then attempt to go to page 50, it...more...
  • Reported in: B5.0 (28-Feb-12)
#48823
PDF page: 49
The use of -> to represent the result of an evaluation is somewhat confusing as there is a macro that uses same symbol. So if you try searching the b...more...
  • Reported in: P1.0 (01-Aug-15)
#78707
Paper page: 50
The last sentence of "Using numeric types": "Notice that only one ​ BigInt ​ literal is needed and is contagious to the entire calculation." is...more...
  • Reported in: P1.0 (13-Nov-13)
#53144
Paper page: 52

the metadata tag attached to the argument `s`
seems to make no visible difference, as :tag
merely shows the tag attached to the retval.

  • Reported in: P1.0 (22-Nov-13)
#53195
Paper page: 57

Add index entry for "inner class, notation for name of" --Phill

  • Reported in: P1.0 (15-Aug-12)
#49671
Paper page: 58
The discussion of traversal order in maps and sets seems out of place. It _follows_ several examples which show (but do not explain) that the order i...more...
  • Reported in: B5.0 (01-Mar-12)
#48848
PDF page: 60
Example on page 60 where you are explaining how maps can be treated as sequences too: (first {:fname "Aaron" :lname "Bedra"}) -> [:lname "Bedra"] ...more...
  • Reported in: P1.0 (15-Aug-12)
#49672
Paper page: 61

The bullet item "Sequence predicates" could be written as "Functions that test sequences".--Rich Morin

  • Reported in: P1.0 (14-Apr-12)
#49110
PDF page: 61
Based on the result of (doc range), 'end' is optional, defaulting to infinity if not provided. The definition of 'range' in the pdf implies 'end' i...more...
  • Reported in: P1.0 (15-Aug-12)
#49673
Paper page: 64

"its argument is vowel." should be "its argument is a vowel.".--Rich Morin

  • Reported in: P1.0 (10-May-12)
#49300
Paper page: 67
I was using Clojure 1.4.0 with the book. Clojure 1.4.0 is a newer version so it could be the Clojure 1.4.0 run-time causing the error. For the c...more...
  • Reported in: P1.0 (10-May-12)
#49301
Paper page: 67

PLEASE IGNORE ISSUE 49300.
I MISTYPED SOME CODE.
This was me being stupid.--G R Smith

  • Reported in: P1.0 (15-Aug-12)
#49675
Paper page: 68

I would change "[according to format instructions]." to "[according to format instructions] [the] word."--Rich Morin

  • Reported in: B4.0 (26-Dec-11)
#48402
PDF page: 69
at the end of the page "As an example of how much more general the functional index-of-any is, you could use code what we just wrote to find the thir...more...
  • Reported in: P1.0 (15-Aug-12)
#49676
Paper page: 73

The format of the example output "-> [Ljava.io.File;@..." does not match what I get from the REPL: "#<File[] [Ljava.io.File;@...>".--Rich Morin

  • Reported in: P1.0 (14-Nov-13)
#53149
PDF page: 73
(import '(java.io File)) (.listFiles (File. ".")) -> [Ljava.io.File;@1f70f15e The syntax (Class. foo) to invoke a java ctor is used here for the...more...
  • Reported in: P1.0 (08-Mar-14)
#76495
PDF page: 76
Section 3.1 "Everything Is a Sequence". Examples: (first {:fname "Aaron" :lname "Bedra"}) and (rest {:fname "Aaron" :lname "Bedra"}) have outputs swit...more...
  • Reported in: P1.0 (15-Aug-12)
#49677
Paper page: 78

The drop/take combination also differs from subvec in that it takes different arguments and is called quite differently.--Rich Morin

  • Reported in: B3.0 (22-Nov-11)
#48016
PDF page: 78
Page 78 on epub on nook touch. Table 2. is getting cut off. the table title stops after "functional", and the last column is "Variables". These may...more...
  • Reported in: P1.0 (15-Aug-12)
#49678
Paper page: 80

I would change "... only the keys passed in." to "... only the pairs for the keys that were passed in.".--Rich Morin

  • Reported in: B4.0 (26-Dec-11)
#48403
PDF page: 87
It might help clarify the power of "for" from map in the example by showing how map differs. user=> (map #(format "%c%d" %1 %2) "ABCDEFGH" (range...more...
  • Reported in: P1.0 (04-Jan-15)
#78010
PDF page: 87

The second footnote contains a broken link. You can easily find the correct link by Googling.--Marcus Russi

  • Reported in: P1.0 (15-Aug-12)
#49679
Paper page: 92
In the tail-fibo code block, "next" is emboldened each time it appears. However, "next" is simply a parameter to the local function fib, not the Cloju...more...
  • Reported in: P1.0 (21-Sep-14)
#77407
PDF page: 94
Paper page: 76

The parse example on page 94 refers to parse without first telling the reader they should user or import xml.

  • Reported in: P1.0 (15-Aug-12)
#49680
Paper page: 95

I would add a usage example after the fibo definition, eg: "(take 5 (fibo))".--Rich Morin

  • Reported in: B5.0 (17-Mar-12)
#48953
PDF page: 96
Under the section Tail Recursion, in the code listing for the 'tail-fibo' function, the formatting rules appear to be that the bold magenta font is us...more...
  • Reported in: B4.0 (25-Feb-12)
#48807
PDF page: 96
In the tail-fibo example: (fib 0N 1N n))) Causes this error in lein repl: java.lang.NumberFormatException: Invalid number: 0N java.lang.Numb...more...
  • Reported in: P1.0 (15-Aug-12)
#49681
Paper page: 100

There is an extra space following the first :t in "[:h :t :t ...", three times on this page.--Rich Morin

  • Reported in: B3.0 (22-Nov-11)
#48017
PDF page: 109
Page 109 in epub on nook touch. The section title for 3.5 is cut off from rendering, and does not wrap. It shows "3.5 Calling Structure-Specific Func...more...
  • Reported in: P1.0 (22-Jan-14)
#76325
PDF page: 111
The second paragraph makes this suggestion "Rebind m and f to memoized versions of themselves, using Clojure’s memoize function", but if I'm typing ou...more...
  • Reported in: P1.0 (15-Aug-12)
#49682
Paper page: 114

I would change "... power into cores." to "... power into individual processing cores."--Rich Morin

  • Reported in: P1.0 (15-Aug-12)
#49683
Paper page: 114

I think that "complect" deserves more than just a footnote. How about an explanatory block?--Rich Morin

  • Reported in: P1.0 (15-Aug-12)
#49684
Paper page: 115
In the paragraph beginning "Clojure's model for ...", the word model is used several times with varying (though related) meanings. This seems needless...more...
  • Reported in: P1.0 (26-May-12)
#49374
Paper page: 115

In the second paragraph, last sentence it says "...and not ask yourself...". That should be 'now' instead of 'not'.--Michael C

  • Reported in: P1.0 (15-Aug-12)
#49685
Paper page: 116
It might be useful to show that the prior value persists after a ref-set call. For example, "(def snap current-track)" before the ref-set and "snap" a...more...
  • Reported in: P1.0 (16-Nov-13)
#53159
PDF page: 116
I believe the description of "atomic" transactions is wrong. The description for atomic is actually roughly quivalent to the "isolated" property des...more...
  • Reported in: P1.0 (05-Jan-13)
#50439
PDF page: 118
In my version of the text,`(alter ref update-fn & args...)` has the word `ref` typeset in bold purple, which makes it appear to be the Clojure `ref` f...more...
  • Reported in: P1.0 (05-Jan-13)
#50440
PDF page: 119
My version of `(commute ref update-fn & args...)` has `ref` in bold purple. This is confusing because it makes it appear that `ref` is a 'built-in' Cl...more...
  • Reported in: P1.0 (11-Jul-12)
#49512
PDF page: 125
I'm not sure if this is a change from 1.3 to 1.4, but I don't see a change-note in 1.4, so … See: After the agent tries to update itself on a po...more...
  • Reported in: P1.0 (15-Aug-12)
#49687
Paper page: 127

"in the following tabler." should be "in the following table."--Rich Morin

  • Reported in: P1.0 (22-Nov-13)
#53196
Paper page: 127
I think maybe the top row of the table is what the sentence below the table refers to with "the unified update model is the most important way...", wh...more...
  • Reported in: P1.0 (16-Apr-12)
#49122
PDF page: 127

Last word of the first paragraph under 5.4's "The Unified Update Model"

"Tabler" should be "Table"--Cameron Donaldson

  • Reported in: P1.0 (17-Nov-13)
#53163
PDF page: 128
the inclusion of metadata tag ^:dynamic in `(def ^:dynamic foo 10)` is distracting. it's not explained, nor even mentioned, it's unclear whether the i...more...
  • Reported in: B3.0 (23-Nov-11)
#48027
PDF page: 130
The Sharp is not getting rendered after the C and the flat is not getting rendered after the D. Those are non-printable characters it would seem. In...more...
  • Reported in: P1.0 (07-Sep-12)
#49788
Paper page: 131
in manual has printed an old form for : ...... (startElement [uri local-name q-name #^Attributes atts] .......... the form #^..... is not f...more...
  • Reported in: B4.0 (19-Feb-12)
#48780
PDF page: 134
The sentence "When you call def or defn, you create a dynamic var, often called just a var." is somewhat misleading. A var is only dynamic if it ha...more...
  • Reported in: P1.0 (18-Apr-12)
#49127
PDF page: 140
"Line 15 returns a vector with the snake, apple, and time" should read "Line 15 returns a vector with the snake, apple, and timer"--Cameron Dona...more...
  • Reported in: P1.0 (13-Feb-13)
#50790
Paper page: 147
(definterface IOFactory (^java.io.BufferReader make-reader [this]) (^java.io.BufferedWriter make-writer [this])) should be : (definterfa...more...
  • Reported in: P1.0 (14-Sep-12)
#49806
Paper page: 147
in (definterface IOFactory has an error in: (^java.io.BufferReader make-reader [this]) ...... correct in (^java.io.BufferedRea...more...
  • Reported in: P1.0 (14-Sep-12)
#49804
Paper page: 150

in
make-writer[dst]
for URL is wrong
(->dst .getPath FileInputStream.)

correct :
(->dst .getPath FileOutputStream.)

--ugo vierucci

  • Reported in: P1.0 (14-Sep-12)
#49807
Paper page: 150

after :

Now let's put it all together

add the row
src/examples/io.clj
in reversed mode as in previous pages

--ugo vierucci

  • Reported in: B3.0 (22-Nov-11)
#48018
PDF page: 150
Page 150 in epub on nook touch. Chapter 5. The title of the chapter is cut off and not rendering the complete chapter name. It is rendering "Protoc...more...
  • Reported in: B5.0 (05-Apr-12)
#49066
PDF page: 150
very very minor suggestion - I think the line "Clojure’s spit and slurp I/O functions are built on two abstractions, reading and writing." at the top ...more...
  • Reported in: P1.0 (14-Sep-12)
#49805
Paper page: 151
in make-writer [dst ] for URL has an error in: (-> dst .getPath FileInputStream.) correct in (-> dst .getPath FileOuputStream.) --ugo v...more...
  • Reported in: P1.0 (14-Sep-12)
#49808
Paper page: 155
in (ns examples.cryptovault_complete (:require [clojure.java.io :as io] [examples.protocols.io :as proto]) ....................... ...more...
  • Reported in: P1.0 (09-May-14)
#76778
PDF page: 157

C (C sharp) should be C# (C sharp)
D (D flat) should be Db (D flat)
D half note should be D# half note--art g

  • Reported in: B3.0 (22-Nov-11)
#48015
PDF page: 161
Page 161 of epub on nook touch. The cryptovault.clj code formatting is off with the line wraps weird. The "... define method body here ...)" is havi...more...
  • Reported in: P1.0 (06-May-14)
#76769
PDF page: 162
Paper page: 180
In section 6.6 - when calling reify on MidiNote there are a number of errors in the generator.clj implementation. All the functions defined in MidiNot...more...
  • Reported in: B4.0 (30-Dec-11)
#48431
PDF page: 166
This may or may not be a technical error but even when copy-and-pasting sample code (and/or typing it manually from the book) I get the following mess...more...
  • Reported in: B5.0 (05-Mar-12)
#48890
PDF page: 174
Paper page: 160

src/examples/cryptovault.clj

(init-vault [vault]

should read

(defn init-vault [vault]

--Ernesto Schirmacher

  • Reported in: B5.0 (05-Mar-12)
#48891
PDF page: 175
Paper page: 161
The two method definitions in the code listings are missing the defn: (vault-output-stream [vault] SHOULD READ (defn vault-output-stream [vault] ...more...
  • Reported in: P1.0 (30-Aug-12)
#49770
PDF page: 177
Paper page: 159
It's just the absence of the final closing parenthesis: (extend-type Note MidiNote (to-msec [this tempo] (let [duration-to-bpm {1 240, 1...more...
  • Reported in: P1.0 (20-Nov-13)
#53185
PDF page: 178
There's a distinction to be made between special forms hardcoded into the language evaluator, and macro invocation where args are evaulated differen...more...
  • Reported in: P1.0 (30-Aug-12)
#49771
PDF page: 179
Paper page: 161
Got this error with the dot syntax for a new instance: user=> (perform (for [velocity [64 80 90 100 110 120]] (assoc (Note. :D 3 1/2) :velocity ve...more...
  • Reported in: P1.0 (20-Nov-13)
#53186
PDF page: 184
up to this point in the book, no discussion or mention of exceptions/try/finally has been made. the comment on "using a finally block" lacks the pro...more...
  • Reported in: P1.0 (08-Mar-14)
#76494
PDF page: 184
Section 3.1 "Everything Is a Sequence". Examples: (first {:fname "Aaron" :lname "Bedra"}) and (rest {:fname "Aaron" :lname "Bedra"}) have outputs swit...more...
  • Reported in: P1.0 (17-Jun-13)
#52018
PDF page: 190
prose concerns my-print, code example uses my-println instead: " Unsurprisingly, attempts to call my-print will fail: (my-println "foo") " --gi...more...
  • Reported in: B4.0 (15-Jan-12)
#48530
PDF page: 201
You use ::acc/Checking in the namespace corresponding to the one aliased to acc in namespace user. Besides this, I think it is confusing to use :: in ...more...
  • Reported in: P1.0 (12-Sep-15)
#78819
PDF page: 205
Modify the existing my-println to add a new cond invoking the feature-specific helper. should be Modify the existing my-print to add a new cond...more...
  • Reported in: P1.0 (12-Mar-14)
#76529
Paper page: 217

(defn painstakingly-create-array []
...
(aset arr2 "fill)
---------^--Frei zhang

  • Reported in: P1.0 (26-Sep-12)
#49887
PDF page: 232
Paper page: 217
There is a typo in the function: (aset arr2 "fill") (defn painstakingly-create-array [] (let [arr (make-array String 5)] (aset arr 0 "Painstaking...more...
  • Reported in: P1.0 (02-Apr-13)
#51191
PDF page: 235

3rd line:
- How hard is it write a program
should be:
- How hard is it to write a program--Roman

  • Reported in: P1.0 (02-Apr-13)
#51192
PDF page: 237
Last line is: (< 0 (matches score) (count secret))) Should be `<=` instead of `<`, as the range for the number of matches should include the edges...more...
  • Reported in: P1.0 (21-Nov-12)
#50189
PDF page: 240
Paper page: 225

This does not work on windows "java -cp .:pinger-0.0.1-standalone.jar pinger.core". The classpath uses ';' semi colons on windows.--Robin Luiten

  • Reported in: P1.0 (02-Apr-13)
#51190
PDF page: 240

First line:
- test-namespaces takes on more namespaces
should be:
- test-namespaces takes one or more namespaces--Roman

  • Reported in: P1.0 (02-Apr-13)
#51193
PDF page: 243
The command `lein plugin install lein-noir 1.2.0` no longer works. In Leiningen 2.x plugins should be specified in `project.clj` or `~/.lein/profiles....more...
  • Reported in: P1.0 (02-Apr-13)
#51194
PDF page: 243

`lein noir new clojurebreaker`
should be
`lein new noir clojurebreaker`--Roman

  • Reported in: P1.0 (15-Aug-12)
#49688
Paper page: 249

The "Git" heading needs to be swapped with the paragraph "This will provide ...".--Rich Morin

  • Reported in: P1.0 (02-Oct-12)
#49912
PDF page: 253
Paper page: 238
The name of the function is wrong: (scoring-is-bound-by-number-of-pegs secret guess (game/score secret guess)) This should be: (scoring-is-bo...more...
  • Reported in: P1.0 (22-Nov-13)
#53194
Paper page: 260

Index entry for "extend" should also "see proxy"--Phill

  • Reported in: P1.0 (15-Aug-12)
#49689
Paper page: 262

Add an index entry for load-file.--Rich Morin