Huh. I was also unaware of the run! function. I suppose you could always write it like this:
(def x (vec (range 3))) (def y (vec (reverse x))) (run! (fn [[x y]] (println x y)) (map vector x y)) > lein run 0 2 1 1 2 0 although the plain old for loop with dotimes looks simpler: (dotimes [i (count x) ] (println (x i) (y i))) maybe that is the best answer? It is hard to beat the flexibility of a a loop and an explicit index. Alan On Fri, Sep 23, 2016 at 12:11 AM, Mars0i <marsh...@logical.net> wrote: > On Friday, September 23, 2016 at 1:47:45 AM UTC-5, Francis Avila wrote: >> >> It's not crystal clear to me what you are after, either from this post or >> the one you link to. I think you want a map that does not produce >> intermediate collections and accepts multiple colls as input at a time? > > > Yes. > > >> Do you have some pseudocode example so we can be precise? > > > What I was imagining most recently was something like this: > > (doseq* [x (range 3) > y (reverse (range 3))] > (println x y)) > > which would display: > > 0 2 > 1 1 > 2 0 > > as opposed to > > (doseq [x (range 3) > y (reverse (range 3))] > (println x y)) > > which displays > > 0 2 > 0 1 > 0 0 > 1 2 > 1 1 > 1 0 > 2 2 > 2 1 > 2 0 > > What about (run! my-side-effect-fn coll) >> >> This doesn't handle multiple coll at a time like the sequence function, >> but you can tupleize coll with (map vector coll1 coll2) at some loss of >> efficiency. Or you can roll your own. >> > > Very nice--I didn't know about run! (!) Yes, that would do it, except > that it requires constructing unnecessary collections when you want to > process multiple sequences. We we able do the same tupelize trick with > doseq, before run! appeared. > > However, since we have run!, which is exactly what I wanted a year and a > half ago except that it doesn't handle multiple collections, I would > suggest simply enhancing run! to allow multiple sequence arguments: > > (run! (fn [x y] (println x y)) > (range 3) > (reverse (range 3)) > > which would produce: > > 0 2 > 1 1 > 2 0 > > > > -- > 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 > --- > 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 clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 --- 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 clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.