在这一段clojure代码中:
(defn makeStructs ;line 27
"open fName as a file and turns each line into a struct. Returns a Vector of structs"
[fName]
with-open[r (reader (file fName))]
(let [r
res (doall (map makeStruct (line-seq r)))
]
(. r close)
res
)
)
我收到此编译器错误:
Exception in thread "main" java.lang.Exception: Can't take value of a macro: #'clojure.core/with-open (clojureHW.clj:27)
上面注释了第 27 行。
知道问题是什么吗?
最佳答案
你需要实际调用宏,
(defn makeStructs ;line 27
"..."
[fName]
(with-open ; note the extra paren
关于clojure - 无法获取宏的值(clojure),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5751262/