Oops. Just noticed that the original was not quoted in either of my
previous emails, which makes things really confusing. My first reply (the
one using read-lines) was an extension of odyssomay/Jonathan's code, and the
second (with reader) was an extension of Meikel's code. Sorry guys.
--
Y
I think line-seq needs a java.io.BufferedReader instead of a
java.io.FileReader. clojure.java.io has a reader function that constructs a
java.io.BufferedReader from a filename, so this worked for me:
(ns example
(:use [clojure.java.io :only (reader)]))
(with-open [rdr (reader "file.txt")]
Hi,
something like the following should work.
(with-open [rdr (java.io.FileReader. "file.txt")]
(doseq [line (line-seq rdr)
word (.split line "\\s")]
(when (.endsWith word "ing")
(println word
Sincerely
Meikel
--
You received this message because you are subscribed to