• (doc name)
Prints documentation for a var or special form given its name

2 Examples top

  • => (doc map)
    ;; prints in console:
    -------------------------
    clojure.core/map
    ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])
      Returns a lazy sequence consisting of the result of applying f to the
      set of first items of each coll, followed by applying f to the set
      of second items in each coll, until any one of the colls is
      exhausted.  Any remaining items in other colls are ignored. Function
      f should accept number-of-colls arguments.
  • user> (doc clojure.core)
    -------------------------
    clojure.core
      Fundamental library of the Clojure language
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/repl.clj:120 top

(defmacro doc
  "Prints documentation for a var or special form given its name"
  {:added "1.0"}
  [name]
  (if-let [special-name ('{& fn catch try finally try} name)]
    (#'print-doc (#'special-doc special-name))
    (cond
      (special-doc-map name) `(#'print-doc (#'special-doc '~name))
      (resolve name) `(#'print-doc (meta (var ~name)))
      (find-ns name) `(#'print-doc (namespace-doc (find-ns '~name))))))
Vars in clojure.repl/doc:
Used in 0 other vars

Comments top

1 comment(s) for doc.

Note that the clojure.repl namespace which contains doc is not loaded by default in Emacs' SLIME mode, because SLIME provides its own doc function via C-c C-d d.

Log in to add a comment.