Let's say I've got a finite, unknown number of valid clojure forms in
a file, say like this:
(foo)(bar)[blah blah blah](and one more)
(note there is a vector sandwiched in there too)
Let's say I open this file and want to use it with read:
(read f) = (foo)
I do it again, and:
(read f) = (bar)
Hi,
you can use lazy-seq:
(def eof-marker (Object.))
(defn read-all
[stream]
(lazy-seq
(let [x (read stream false eof-marker)]
(when-not (identical? x eof-marker)
(cons x (read-all stream))
Or go for high-level:
(def eof-marker (Object.))
(defn read-all
[stream]