2011/7/14 OGINO Masanori <masanori.og...@gmail.com>:
> Hello.
>
> What is the right way to display namespace docstrings?
>
> One day, as usual, I typed:
>
> (doc 'clojure.core) ; or other namespace
>
> Then the REPL said "clojure.lang.Cons cannot be cast to clojure.lang.Symbol."
> I thought "Ah, I know, the message means "(quote clojure.core) cannot
> be cast to the symbol clojure.core." I'm wrong." and typed:
>
> (doc clojure.core)
>
> Then the REPL said "ClassNotFoundException clojure.core."
> I thought "Indeed, clojure.core seems to be an class name...
> Precisely, can (doc) display namespace docstrings?" and typed:
>
> (source doc)
>
> Oh, (doc) uses (find-ns), so (doc) should display namespace docstrings. But 
> how?
> Finally I wrote (:doc (meta (the-ns 'clojure.core))) but I know this
> is a wrong way.
> When I forget this ad-hoc solution, I'll repeat above.
>
> I determined to ask it because I have repeated again just now and I'm annoyed.
> Any thought?
>
> Thanks.

'doc' is only used for things that are vars (functions, and other
globals). Namespaces are not vars, so you cannot use 'doc' with them.
To see the docs for a namespace, use the 'print-namespace-doc'
function:

    (print-namespace-doc 'the.name.space)

// raek

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to