I am writing my first clojure program, and want to read lines from stdin.
When I try this:
(doall (map #(println %) (line-seq *in*)))
You should probably use doseq instead of doall:
(doseq [line (line-seq (java.io.BufferedReader. *in*))]
(println line))
doall:
Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time.
doseq:
Does not retain the head of the sequence. Returns nil.