Variadic run!

83 views
Skip to first unread message

Claudius Nicolae

unread,
May 29, 2016, 4:27:54 PM5/29/16
to Clojure
run! can eagerly map a function over a coll.
I think it would be nice to support multiple collections, making it an eager version of map.

My particular use case is running a test over two colls.

    (defn check [m1 m2]
      (is (almost= (:x m1) (:x m2)))
      (is (= (:y m1) (:y m2))))
    (run check coll1 coll2)
Message has been deleted

Leon Grapenthin

unread,
May 29, 2016, 4:46:38 PM5/29/16
to Clojure
run is a high performance version of (dorun (map ...)), implemented via reduce which also doesn't support a variadic fn. Probably (dorun (map ...)) is what you are looking for?

Claudius Nicolae

unread,
May 29, 2016, 5:05:42 PM5/29/16
to Clojure
Yes, I go by `(dorun (map ...` currently .
I was reading [1] and got the impression that run! is to be preferred, but it seems it's not a full replacement.

Reply all
Reply to author
Forward
0 new messages