Perfect, thanks Stuart! That works great :)
I put it in a convenience macro:
; Stuart Sierra
(defmacro defn-with-doc
"Like defn but accepts a procedurally generated string."
[fun doc-str & body]
`(let [f# (defn ~fun ~...@body)]
(alter-meta! (var ~fun) assoc :doc ~doc-str)
f#))
Got
On Jul 7, 12:11 am, Timothy Pratley wrote:
> I have a function that relies on a keyword being supplied. The keyword
> is used to find something in a static map. I want to put in the doc-
> string:
> (str "blah blah blah, arg1 must be one of " (keys map))
> Suggestions?
You can procedurally alter
On Jul 7, 5:11 am, Timothy Pratley wrote:
> I have a function that relies on a keyword being supplied. The keyword
> is used to find something in a static map. I want to put in the doc-
> string:
> (str "blah blah blah, arg1 must be one of " (keys map))
> Suggestions?
You can put the docstring d
> I have a function that relies on a keyword being supplied. The keyword
> is used to find something in a static map. I want to put in the doc-
> string:
> (str "blah blah blah, arg1 must be one of " (keys map))
> Suggestions?
You'd need to generate a suitable function definition using a macro.