This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-06
Channels
- # announcements (1)
- # babashka (117)
- # bangalore-clj (4)
- # beginners (52)
- # calva (3)
- # cider (1)
- # circleci (1)
- # cljsrn (1)
- # clojure (5)
- # clojure-italy (1)
- # clojurescript (5)
- # conjure (23)
- # datahike (32)
- # datomic (12)
- # fulcro (5)
- # graalvm (6)
- # jobs (1)
- # joker (2)
- # kaocha (1)
- # livestream (1)
- # malli (5)
- # meander (4)
- # off-topic (14)
- # pathom (6)
- # re-frame (7)
- # releases (3)
- # reveal (15)
- # sci (1)
- # shadow-cljs (22)
- # spacemacs (7)
(m/rewrite {:a 1 :b 2}
(m/map-of (m/pred keyword? !ks) _) [!ks ...])
;; => [:a :b]
(m/rewrite {:a 1 :b 2}
(m/map-of (m/gather (m/pred keyword? !ks)) _) [!ks ...])
;; => nil
(m/rewrite [:a :b :c 1]
(m/gather (m/pred keyword? !ks) _) [!ks ...])
;; => [:a :b :c]
I think there is a misunderstanding of what gather is for. Gather matches seqables. So you could combine gather with map-of like this.
(m/rewrite {[:a :b 2 :c] 1 [:b :c :d 4 :e] 2}
(m/map-of (m/gather (m/pred keyword? !ks)) _) [!ks ...])
Seems like a rather unlikely thing to be doing. Maybe you were trying to gather up things on a map? Something like this?
(m/rewrite {:a 1 :b 3 "stuff" 5}
{& (m/gather [(m/pred keyword? !k) !v])}
(m/map-of !k !v))
;; => {:a 1 :b 3}