Clojure for the brave and true error in chapter 6?


#1

I am currently reading Clojure for the Brave it’s a fantastic book to learn clojure.
I think there is an error in chapter 6 https://www.braveclojure.com/organization/#Requiring_and_Using_Namespaces where refer is used like so:

(refer 'the-divine-cheese-code.visualization.svg :as :only ['points])

but I can’t find the errata of the book.
Is it really an error or am I missing something ?


#2

I think you are right.

user> (require 'clojure.string)
nil
user> (refer 'clojure.string :as :only ['starts-with?])
IllegalArgumentException No value supplied for key: [starts-with?]  clojure.lang.PersistentHashMap.create (PersistentHashMap.java:77)

You might as well omit :as.

Amazing! A glitch, in the book since 2015!


#3

FWIW, it was reported in the Google Group back in September 2017 https://groups.google.com/forum/#!topic/braveclojure/cveM378fY9Y


#4

Thanks for the link. It’s not fixed even in the online version of the book.
Good book anyway.


#5

Hey! Slightly off topic, but mind sharing how you marked Phil’s reply as the solution?