Prints documentation for any var whose documentation or name
contains a match for re-string-or-pattern
;; Finds everything with struct-map in the name or description. In this case, it finds ;; two things: clojure.core/struct-map and clojure.xml/parse. user=> (find-doc "struct-map") ------------------------- clojure.core/struct-map ([s & inits]) Returns a new structmap instance with the keys of the... nil
(defn find-doc
"Prints documentation for any var whose documentation or name
contains a match for re-string-or-pattern"
{:added "1.0"}
[re-string-or-pattern]
(let [re (re-pattern re-string-or-pattern)]
(doseq [ns (all-ns)
v (sort-by (comp :name meta) (vals (ns-interns ns)))
:when (and (:doc (meta v))
(or (re-find (re-matcher re (:doc (meta v))))
(re-find (re-matcher re (str (:name (meta v)))))))]
(print-doc v))))
Comments top
No comments for find-doc. Log in to add a comment.