Clojure编译问题
为什么下面的代码不能通过编译Clojure编译问题,clojure,Clojure,为什么下面的代码不能通过编译 (defn testit [asym] (var asym)) 错误是: CompilerException java.lang.RuntimeException: Unable to resolve var: asym in this context, compiling:(NO_SOURCE_PATH:1) asym没有var,它是本地的;在本例中,定义为testitvar的值的函数的唯一参数 如果要从该函数返回asym: (defn testit [asy
(defn testit [asym] (var asym))
错误是:
CompilerException java.lang.RuntimeException: Unable to resolve var: asym in this context, compiling:(NO_SOURCE_PATH:1)
asym
没有var
,它是本地的;在本例中,定义为testit
var的值的函数的唯一参数
如果要从该函数返回asym
:
(defn testit [asym] asym)
如果asym
是一个命名要返回的var的符号,则使用resolve
:
(defn testit [asym] (resolve asym))
一般说明:(var x)
是与读取器语法#'x
相对应的扩展