Friday, 15 March 2013

clojure - Does (doc ....) display the document text string of non-core, user defined functions? -



clojure - Does (doc ....) display the document text string of non-core, user defined functions? -

i have:

(defn my-add [a b] "takes 2 numbers , adds them together" (+ b))

this function works expected:

(my-add 3 4) => 7

but when do:

(doc my-add)

all is:

user/my-add ([a b]) nil

whereas if 'doc' on clojure/core function:

(doc str)

i info expect, including text:

clojure.core/str ([] [x] [x & ys]) no args, returns empty string. 1 arg x .....[etc]

why won't user-defined function document text display? thanks

yes. have docstring in fn body.

try:

(defn my-add "takes 2 numbers , adds them together" [a b] (+ b))

clojure

No comments:

Post a Comment