On 28 January 2010 14:49, Meikel Brandmeyer wrote:
> With the "elegant" version you pile lazy-cat on lazy-cat on lazy-cat
> because lazy-cat does delay the evaluation just a lazy-seq does. So
> when accessing the sequencing you have to handle all those lazy-cat
> calls on the stack, which will eve
Hi,
On Jan 28, 2:33 pm, Michał Marczyk wrote:
> However, the original "less elegant" version with the fix I proposed
> alongside the reduce-based version is actually better. (Which I've
> only noticed after posting it -- sorry for the confusion.)
With the "elegant" version you pile lazy-cat on
On 28 January 2010 14:16, timc wrote:
> The last, elegant one works -- marvellous!
>
> Thanks a lot.
Great! You're welcome. :-)
However, the original "less elegant" version with the fix I proposed
alongside the reduce-based version is actually better. (Which I've
only noticed after posting it --
Michal
The last, elegant one works -- marvellous!
Thanks a lot.
Tim
On Jan 28, 1:05 pm, Michał Marczyk wrote:
> Ouch, sorry, this won't work with recur... Use an explicit call instead:
>
> (defn multi-read-lines [sources]
> (when-let [source (first sources)]
> (lazy-cat (read-lines source)
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 wrote:
> On 28 January 2010 13:41, timc wrote:
>
> > Given a collectio
Ouch, sorry, this won't work with recur... Use an explicit call instead:
(defn multi-read-lines [sources]
(when-let [source (first sources)]
(lazy-cat (read-lines source) (multi-read-lines (rest sources)
I guess this would overflow the stack with a huge number of sources, though.
A seco
On 28 January 2010 13:41, timc 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-le
Can anyone please advise on how to structure a sort of 'nested lazy
sequence' in this sense:
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.
Thanks
--