This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-25
Channels
- # aws (1)
- # bangalore-clj (9)
- # boot (97)
- # capetown (1)
- # cider (4)
- # clara (1)
- # cljs-dev (2)
- # cljsrn (109)
- # clojure (258)
- # clojure-finland (3)
- # clojure-greece (2)
- # clojure-italy (1)
- # clojure-russia (33)
- # clojure-spec (41)
- # clojure-uk (46)
- # clojurescript (57)
- # component (17)
- # core-async (6)
- # datomic (13)
- # devcards (10)
- # dirac (2)
- # euroclojure (1)
- # figwheel (1)
- # funcool (1)
- # hoplon (472)
- # luminus (17)
- # off-topic (1)
- # om (16)
- # onyx (40)
- # pedestal (14)
- # proton (12)
- # re-frame (27)
- # reagent (15)
- # ring-swagger (2)
- # specter (5)
- # testing (4)
- # untangled (258)
- # vim (4)
Hi, How could I solve in specter this problem? Given a key (eg: :e) located in an undetermined nested level of a map return the map with only the keys that compose the path to reach it.
For example:
{:a 1 :b {:c 2 :d {:e 3 :f 4} :g {:e 5 :h 8}}}
--> {:b {:d {:e 3} :g {:e 5}}}
@nlessa two ways to go about it
first is to use select
with a recursive path + value collection to get the sequence of paths to your desired key/values. Then construct the nested map manually
second is to make a new navigator like ALL
that removes values when NONE
is returned on transformation
with that you could solve your use case with a single transform
call