On 28 January 2010 13:41, timc <[email protected]> wrote:
> Given a collection (say*command-line-args*) of file names, how to make
> a lazy function that in effect does what clojure.contrib.duck-streams/
> read-lines does, but of all the files in sequence.
How about this:
(defn multi-read-lines [sources]
(when-let [source (first sources)]
(lazy-cat (read-lines source) (recur (rest sources)))))
It would be easy enough to have it accept a variable number of sources
as arguments rather than a single list, if you prefer.
Sincerely,
Michal
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en