Clojure: Doc Lookup, Find Function
This page shows you how to use Clojure help system for reading documentation offline, and how to find functions.
Show Inline Doc of a Function
To get the inline doc of a function, start REPL and call the doc
function.
(doc list) ; show doc of the symbol “list”
Here's a sample output:
user=> (doc list) ------------------------- clojure.core/list ([& items]) Creates a new list containing the items. nil user=>
Finding Function
To list all functions that contains a string/regex in their names, use “apropos”.
◆ clojure
Clojure 1.8.0
user=> (apropos "list")
(clojure.core/list clojure.core/list* clojure.core/list?)
user=>
To search a string/regex in all inline doc, use find-doc
.
(find-doc "list")
Using Emacs CIDER
If you are using emacs CIDER,
you can call
cider-doc
【Ctrl+c Ctrl+d Ctrl+d】
to lookup doc of the fuction under cursor.
There are many functions for looking up doc or finding function:
- C-c C-d C-a cider-apropos
- C-c C-d C-d cider-doc
- C-c C-d C-g cider-grimoire
- C-c C-d C-j cider-javadoc
- C-c C-d A cider-apropos-documentation
- C-c C-d a cider-apropos
- C-c C-d d cider-doc
- C-c C-d g cider-grimoire
- C-c C-d h cider-grimoire-web
- C-c C-d j cider-javadoc
〔see Emacs: Clojure CIDER Tutorial〕