Well, you can always use the (time) macro and pick what runs faster:

(dorun (map some-fn-with-side-effects sequence-1 sequence-2))

(doseq [x (map some-fn-with-side-effects sequence-1 sequence-2))])

(doseq) could be faster in some cases because its implementation uses
chunked sequences. Now, (doseq) can take multiple sequences, but that
may not be what you want:
user=> (doseq [x '(1 2) y '(3 4)] (println x y))
1 3
1 4
2 3
2 4



On Jan 23, 3:51 am, joachim <joachim.de.be...@gmail.com> wrote:
> First: Thanks all for your thoughts.
>
> Second: I have the same question as Allen (why would the doseq variant
> be faster in this case?)
>
> Finally: so I guess that what I did was also OK then?
>
> Jm
>
> On Jan 20, 9:57 pm, Alan Malloy <a...@malloys.org> wrote:
>
>
>
>
>
>
>
> > But I don't see any reason why this would be faster than (dorun (map
> > side-effect-fn s1 s2 s3)). You're creating and then dismantling a
> > three-element vector at every iteration to no purpose.
>
> > On Jan 20, 12:40 pm, Meikel Brandmeyer <m...@kotka.de> wrote:
>
> > > Hi,
>
> > > to add to Lars answer:
>
> > > (doseq [[a b c] (map vector s1 s2 s3)]
> > >   (side-effect-fn a b c))
>
> > > This should do the trick.
>
> > > Sincerely
> > > Meikel

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