;; Try to read 3 lines of text from a test file and return them (to the REPL)
;; as a list:
(with-open [r (clojure.java.io/reader "test-0.txt")]
(binding [*in* r] (repeatedly 3 read-line)))
;; The above returns a lazy seq without reading any lines while *in* is bound
;; to the file, resulting in the original *in* (usually stdin) being read.
;; To fix, wrap the body within the *in* binding in (doall ...):
(with-open [r (clojure.java.io/reader "test-0.txt")]
(binding [*in* r] (doall (repeatedly 3 read-line))))
;; That ensures the sequence will be fully realized with the binding of *in*
;; still in effect, thus reading all 3 lines from the test file.