This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-03
Channels
- # beginners (112)
- # boot (13)
- # cider (17)
- # cljsjs (2)
- # cljsrn (8)
- # clojure (57)
- # clojure-spec (2)
- # clojure-uk (5)
- # clojurescript (51)
- # cursive (4)
- # data-science (15)
- # datomic (1)
- # duct (17)
- # garden (4)
- # lein-figwheel (49)
- # midje (1)
- # nyc (1)
- # off-topic (8)
- # pedestal (1)
- # portkey (20)
- # re-frame (4)
- # reagent (27)
- # ring (1)
- # shadow-cljs (24)
- # spacemacs (7)
- # specter (3)
- # sql (5)
- # yada (5)
If I have a map, how would I transform MAP-VALS
but also passing the key corresponding to the val to the function? The issue is that if I just use ALL
, it also transforms the keys, which I don't want; but if I use MAP-VALS
, then I lose the context of the key. I realize that with I can just use map
to achieve this without Specter, but then I'd have to use (into {})
to get it back to a map. I'm transforming the map a lot, so this is undesirable.
@montanonic the pattern for that is (transform [ALL (collect-one FIRST) LAST] (fn [k v] ...) data)
š 4
Ahh, nice. Thanks!