Re: Aw: Clojure example code snippets

2011-05-19 Thread Benny Tsai
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

Re: Aw: Clojure example code snippets

2011-05-19 Thread Benny Tsai
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")]