~ % clj
Clojure 1.10.1
user=> (defn ^{:doc (str "foo" "bar")} f [x] x)
#'user/f
user=> (doc f)
-------------------------
user/f
([x])
foobar
nil
user=>
替换 str 调用为所需的任何内容。您也可以事后更改文档字符串。
user=> (alter-meta! #'f assoc :doc "something")
{:doc "something", :arglists ([x]), :line 1, :column 1, :file "NO_SOURCE_PATH", :name f, :ns #object[clojure.lang.Namespace 0x72ba28ee "user"]}
user=> (doc f)
-------------------------
user/f
([x])
something
nil
user=>