Ask coding questions

← Back to all posts
Access clojure doc?
FlorianBachmann (3)

One great feature of the Clojure REPL is, just like in Python, I can see all docs from command line. However, when I try to find documention for a function on repl.it, it just tells me:

>  (doc +)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: doc in this context, compiling:(/tmp/form-init5573722001909549908.clj:1:1) 

Does anybody a solution?

Comments
hotnewtop
ChangaImara (1)

The clojure.REPL namespace isn’t loaded by default. (refer 'clojure.repl) to get all its vars available in your namespace. (doc +) should work after that.

Linkozera (1)

@ChangaImara I’ve tested today and had to require it using (require ‘[clojure.repl :refer :all]).

ChangaImara (1)

@Linkozera Yep. 100% correct. require/refer is definitely the idomatic way.