Like clojure.core/line-seq but opens f with reader. Automatically
closes the reader AFTER YOU CONSUME THE ENTIRE SEQUENCE.
(defn read-lines
"Like clojure.core/line-seq but opens f with reader. Automatically
closes the reader AFTER YOU CONSUME THE ENTIRE SEQUENCE."
[f]
(let [read-line (fn this [^BufferedReader rdr]
(lazy-seq
(if-let [line (.readLine rdr)]
(cons line (this rdr))
(.close rdr))))]
(read-line (reader f))))
Comments top
1 comment(s) for read-lines.
Note this is deprecated: http://clojure.github.com/clojure-contrib/#duck-streams