You're viewing version 1.2.0 of doc. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16
  • (doc name)
Prints documentation for a var or special form given its name

1 Example top

  • user=> (doc first)
    -------------------------
    clojure.core/first
    ([coll])
      Returns the first item in the collection. Calls seq on its
        argument. If coll is nil, returns nil.
    nil
    
    user=> (doc rest)
    -------------------------
    clojure.core/rest
    ([coll])
      Returns a possibly empty seq of the items after the first. Calls seq on its
      argument.
    nil
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:3880 top

(defmacro doc
  "Prints documentation for a var or special form given its name"
  {:added "1.0"}
  [name]
  (cond
   (special-form-anchor `~name)
   `(print-special-doc '~name "Special Form" (special-form-anchor '~name))
   (syntax-symbol-anchor `~name)
   `(print-special-doc '~name "Syntax Symbol" (syntax-symbol-anchor '~name))
   :else
    (let [nspace (find-ns name)]
      (if nspace
        `(print-namespace-doc ~nspace)
        `(print-doc (var ~name))))))

Comments top

No comments for doc. Log in to add a comment.