【发布时间】:2012-01-23 09:47:34
【问题描述】:
我正在使用这个函数在 Clojure 中写入文件。
(defn writelines [file-path lines]
(with-open [wtr (clojure.java.io/writer file-path)]
(doseq [line lines] (.write wtr line))))
但这总是会产生这个错误:
IllegalArgumentException No matching method found: write for
class java.io.BufferedWriter in
clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:79)
我在这里做错了什么?
【问题讨论】:
-
为了更清楚起见,您能否在您的问题中添加一个示例函数调用?很可能证实了 opqdonut 的回答。
-
不是您问题的答案,但在这种情况下可能会很有趣:stackoverflow.com/questions/7756909/…