By Developers, For Developers

Historical errata for Mastering Clojure Macros

PDF PgPaper PgTypeDescriptionFixed onComments
43TYPO

Output at bottom of the page indicates:

expected: (= 1 (throw (Exception.)))

but should be

expected: (= 1 (do (throw (Exception.)) 1))

2016-11-07Thanks for reporting this. Will be fixed in the next version.
xiTYPO

Section “What’s in This Book? Chapter 2,”: ‘of’ missing in These are some the …
(Very minor typo indeed.)

2016-11-07Thanks! This will be fixed in the next version.
39SUGGEST

Replace
Luckily, we can get the best of both worlds by wrapping a macro as a thin wrapper around the function version:
with
Luckily, we can get the best of both worlds by using a macro as a thin wrapper around the function version:

2016-11-07Thanks! Will be fixed in the next version.
114TYPO

data List = Nil | Cons Int List

Well, Elm uses “type” instead of “data” as the reserved word for building algebraic data types.

2016-11-07I think this comment might be for a different book? The text here doesn't seem to be in this book, and this book's PDF only has 111 pages (so page #114, the one listed here, doesn't exist).
7SUGGEST

In the code listing for `when.clj` the symbol `test` is in bold. (Probably because there is a core function named `test`.) I think this (and other code listings) would be easier for new readers if the `test` symbol was not bold.

I'll check on this. Thanks for bringing it up!
13TYPO

The penultimate paragraph has a phrase “either remember know by heart.” I suspect that what was intended is “either remember or know by heart.”

2016-11-07Thanks!
9ERROR

The `cond` macro in `basics.cond.clj`, which ought to be recursive, calls out to the `clojure.core` version.

Solution: Delete the `clojure.core/` from the final line, changing the final form from
`(cons ’clojure.core/cond (next (next clauses)))`
to
`(cons ’cond (next (next clauses)))`

The same applies to the two subsequent examples.

2016-11-07Sorry for the late reply here - this is the actual definition of `clojure.core/cond`, not an example I wrote. I will introduce it with a bit more clarity.
38TYPO

join-input-lines takes separator as a parameter, then ignores it and uses a literal “,”. I’m pretty sure the intention was for separator to appear as the third argument in the call to replace.

2016-11-07Yep, absolutely, thanks!
34ERROR

This is a bit of a nitpick, but a macro can actually emit a call to a private function in a different namespace by derefing the fully qualified var which holds the function. I.e.

(@#’macro-ns/helper-func 1 2 3)

2016-11-07Good point, "must" is too strong, but I think the overarching point about where to be careful stands. I'll soften the language there. Thanks!
44ERROR

A couple of things here:
1) our-is uses the test/try-expr macro, not the try-expr function defined immediately prior.
2) The first arity of our-is calls f. To be true to the example, the call to f should only occur in the try-expr function.

2016-11-07Yep, this was problematic. Thanks!
86TYPO

The research on Scheme quoted on that page was conducted by Culpepper and Felleisen, not Culpepper and Felleison.

Categories: