Reputation: 1157
(defn file-read
[filename]
(with-open
[r (clojure.java.io/reader filename)]
(doseq
[line (line-seq r)]
*here i want to store the line in an array of strings or something*
)
)
)
After reading the line from a text document, i want to store it. I am new to clojure and have no idea how to do this.
Upvotes: 0
Views: 396
Reputation: 87119
instead of (doseq [line (line-seq r)] ...)
just use (doall (line-seq r))
- it will force evaluation of the line-seq
into sequence, and return it.
Upvotes: 1