On Fri, Jan 20, 2012 at 8:18 AM, joachim <joachim.de.be...@gmail.com> wrote:
> Hi All,
>
> Here is a simple problem for which I nevertheless can't seem to find
> the right solution: How to run over several sequences in parallel for
> side-effects? Here is one way:
>
>     (dorun (map some-fn-with-side-effects sequence-1 sequence-2))
>
> However, I was told that the form "(dorun (map ... ))" indicates that
> doseq should be used instead because it is faster, and I can use
> speed. I think that this is not possible however because doseq only
> allows to loop over a single sequence at a time? I was wondering what
> is the idiomatic clojure way in this case?

You know that (map f seq1 seq2) means call f with one argument from
seq1 and one from seq2 in turn, until one of the sequences has been
exhausted?

Does

  => (map #(vector %1 %2) [1 2 3] ['a 'b 'c])
  ([1 a] [2 b] [3 c])

Seem like the result you would expect or not, when you talk about "run
over several sequences in parallel"?

Lars Nilsson

-- 
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