Re: procedural docstring attachment + argument descriptions

2009-07-07 Thread Timothy Pratley
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

Re: procedural docstring attachment

2009-07-07 Thread Stuart Sierra
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

Re: procedural docstring attachment

2009-07-07 Thread philip.hazel...@gmail.com
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

Re: procedural docstring attachment

2009-07-06 Thread Richard Newman
> 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.