Maybe this bit of code serves your purpose or leads you in some useful
direction.
(ns doc-query
(:use clojure.repl))
(defn seq-docs
"Prints the docstrings of a seq of symbols."
[s]
(with-out-str (doseq [x s] (eval `(doc ~x)))))
(defn ns-docs
"Given a namespace object or its symbol returns a string with all
the docstrings of the interned vars in that ns."
[ns-sym]
(let [refs (->> ns-sym the-ns ns-interns keys (filter (complement nil?)))]
(apply str (seq-docs refs))))
(let [nss (all-ns)
docs (->> nss (map ns-docs) (apply str))]
(spit "docs.txt" docs))
(spit "special.txt" (seq-docs '(def let loop recur ,,,)))
To get the documentation for the special forms you can create a list with their
symbols and use it with the seq-docs function as shown in the last expression.
HTH,
Juan
On Thursday, September 26, 2013 7:44:10 AM UTC+8, Marek Kubica wrote:
>
> Hi,
>
> I was thinking of extracting the information that (doc) returns, but I
> couldn't find an universal way to do it:
>
> - When I use (meta (var foo)) this works, but only for functions
> - I looked in the source code of clojure.repl/doc but it uses a lot of
> private functions, that I'd have to copy & paste
>
> So, is there any universal way to get docs of special forms as well?
>
> Thanks in advance!
>
> regards,
> Marek
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.