This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-04
Channels
- # announcements (7)
- # babashka (32)
- # beginners (106)
- # bristol-clojurians (10)
- # cider (6)
- # clj-kondo (5)
- # cljdoc (10)
- # clojure (110)
- # clojure-australia (10)
- # clojure-dev (6)
- # clojure-europe (12)
- # clojure-nl (2)
- # clojure-norway (16)
- # clojure-spec (9)
- # clojure-uk (59)
- # clojurescript (105)
- # community-development (2)
- # conjure (46)
- # cursive (12)
- # data-science (1)
- # datalog (26)
- # datomic (37)
- # docker (4)
- # emacs (10)
- # events (1)
- # fulcro (8)
- # graalvm (2)
- # jobs (1)
- # jobs-discuss (1)
- # malli (24)
- # meander (13)
- # off-topic (52)
- # pathom (4)
- # polylith (17)
- # proletarian (4)
- # react (1)
- # rewrite-clj (4)
- # shadow-cljs (56)
- # sql (21)
- # xtdb (14)
@huxley I remember now one of the reasons I paused working on a transducer version: disjunctions.
I was taking a moment to play around with it. I ended up with something kinda gross like
(defn x-some [xg1 xg2]
(fn [rf]
(fn
([] (rf))
([acc] (rf acc))
([acc x] (rf (algorithms/mix ((xg1 rf) acc x) ((xg2 rf) acc x)))))))
where xg1
and xg2
are xform goals.Maybe this is fine since conjunctions are the most common and those play nicely with transducers.
but basically all we need to do is add the ability to use into []
at m/search
and we get ~10-15% for free
:search
- `(mapcat
- (fn [~(:symbol ir)]
- ~(compile* (:body ir) fail kind))
- ~(compile* (:value ir) fail kind))))
+ (if (use-transduces?)
+ `(into []
+ (mapcat
+ (fn [~(:symbol ir)]
+ ~(compile* (:body ir) fail kind)))
+ ~(compile* (:value ir) fail kind))
+ `(mapcat
+ (fn [~(:symbol ir)]
+ ~(compile* (:body ir) fail kind))
+ ~(compile* (:value ir) fail kind)))))
The same is true for ...permutations-with-unselected
, but there the speed gain is marginal.