you can still structure you computation as a reduce, even if it is side effectful.
(reduce (fn [sink record] (emit sink record) sink) sink source) There is also a function introduced in 1.7 called "run!" which is for processing a collection using reduce for side effects. On 03/07/2016 04:49 PM, [email protected] wrote: > Thanks for your reply, > > ArchiveReader is actually an Iterator for ArchiveRecord > (see > https://github.com/iipc/webarchive-commons/blob/master/src/main/java/org/archive/io/ArchiveReader.java#L51). > I also tried to explicitly do (iterator-seq (.iterator warc-value)) but > got the same "got 0" everywhere. > > However, your remark about the lazy-seq was indeed very helpful. I tried > to use a loop instead of doseq, and it did the trick! > I also succeeded in using coll-reduce instead of the explicit loop. > However, it seems odd to use it, since I am really only doing a > side-effecting loop (emitting key/values for hadoop's reducer) rather > than making a transformation.. > > Is there a nicer (idiomatic core) way to treat non-chunk-able java > iterables other than an explicit loop for side-effects? > > Thanks! > > -- > 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 > --- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] > <mailto:[email protected]>. > For more options, visit https://groups.google.com/d/optout. -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
