This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-28
Channels
- # aws (7)
- # beginners (69)
- # boot (67)
- # cider (9)
- # cljs-dev (159)
- # cljsrn (2)
- # clojars (25)
- # clojure (345)
- # clojure-austin (9)
- # clojure-berlin (1)
- # clojure-dusseldorf (10)
- # clojure-italy (3)
- # clojure-nl (1)
- # clojure-portugal (1)
- # clojure-spec (73)
- # clojure-uk (59)
- # clojurescript (163)
- # clojurewerkz (1)
- # component (26)
- # core-matrix (2)
- # cursive (20)
- # datascript (32)
- # datomic (15)
- # dirac (16)
- # emacs (3)
- # hoplon (35)
- # jobs-discuss (87)
- # jobs-rus (95)
- # luminus (15)
- # om (135)
- # om-next (3)
- # onyx (47)
- # pedestal (67)
- # perun (74)
- # play-clj (4)
- # portland-or (1)
- # proton (4)
- # re-frame (13)
- # reagent (18)
- # remote-jobs (17)
- # rum (20)
- # specter (11)
- # untangled (101)
- # yada (18)
I'd like to collect all names along all paths... so that I end up with a list of ["blah" "foo"] ["blah" "bar"]
@ghadi you can use value collection for that
(def data
{:foo {:type "blah"
:properties {:foo {:type "bar"}
:foo2 {:type "foo"}}}})
(def MY-WALKER
(recursive-path [] p
(continue-then-stay
MAP-VALS
(collect-one :type)
:properties
p
)))
(select MY-WALKER data)
;; => [["blah" "bar" nil] ["blah" "foo" nil] ["blah" {:foo {:type "bar"}, :foo2 {:type "foo"}}] {:foo {:type "blah", :properties {:foo {:type "bar"}, :foo2 {:type "foo"}}}}]
for selection it returns each collected :type
followed by the node value at that point
for transformation, your transform-fn will receive same thing but as arguments
edited it