Thanks Michal -- however, (multi-read-lines *command-line-args*)
produces this exception:

 java.lang.IllegalArgumentException: Mismatched argument count to
recur, expected: 0 args, got: 1


On Jan 28, 12:54 pm, Michał Marczyk <michal.marc...@gmail.com> wrote:
> On 28 January 2010 13:41, timc <timgcl...@gmail.com> 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to