【发布时间】:2014-01-12 12:21:13
【问题描述】:
来自 REPL (Cloure 1.4.0) 我正在尝试使用 source 宏来显示我的函数的定义 - 但它回复为“找不到源”
我可以像这样在source 上使用source(并且可以看到它使用source-fn) - 但不知道为什么它不喜欢我的defn x[] "hello" 函数定义?
user=> (source source)
(defmacro source
"Prints the source code for the given symbol, if it can find it.
This requires that the symbol resolve to a Var defined in a
namespace for which the .clj is in the classpath.
Example: (source filter)"
[n]
`(println (or (source-fn '~n) (str "Source not found"))))
nil
user=> (defn x[] "hello")
#'user/x
user=> (source x)
Source not found
nil
user=>
【问题讨论】: