出于某种原因,编译并运行此功能(在CIDER中)将导致以下错误:
1. Unhandled java.io.IOException
Stream closed
(defn file-lines
[path]
(with-open [file-reader (clojure.java.io/reader path)]
(line-seq file-reader)))
(file-lines "test")
示例文件test
:
one
two
three
显然,预期结果与("one" "two" "three")
一致。