doseq is a macro that accepts comprehension clauses like "for", so doseq is 
a straight translation of for that is eager (but still uses seqs 
internally) and swallows its body's results.

run! is like more like (doall (map f xs)), except it swallows results and 
uses "reduce" for speed and efficiency (no seq allocations).

In general, if I am side-effecting at the end of a ->> threading macro 
pipeline, I use run!. If I care about speed I use run! Otherwise I use 
doseq because it looks and feels more "statement-y" to me.


On Saturday, December 24, 2016 at 12:16:50 PM UTC-6, Shantanu Kumar wrote:
>
> I'm curious about `clojure.core/run!` too, but my question is whether it 
> is meant to be a `reduce` variant of `clojure.core/doseq` or it has some 
> other purpose.
>
> Shantanu
>
> On Saturday, 24 December 2016 21:37:11 UTC+5:30, James Reeves wrote:
>>
>> My understanding is that the convention used in clojure.core is to put an 
>> exclamation mark onto the end of any function unsafe to run in a 
>> transaction.
>>
>> Does the reasoning differ for "run!" or is it assumed that the function 
>> passed to "run!" will not usually be idempotent?
>>
>> - James
>>
>

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

Reply via email to