我正在使用此函数在Clojure中写入文件。在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的答案。 – Gert 2011-12-19 08:42:43
不是您的问题的答案,但可能在此上下文中有趣:http://stackoverflow.com/questions/7756909/in-clojure-1-3-how-to-read-and-write-a-file/ 7757674#7757674 – 2011-12-19 16:40:22