This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-06
Channels
- # announcements (1)
- # babashka (7)
- # beginners (93)
- # bristol-clojurians (1)
- # cider (7)
- # clj-kondo (42)
- # cljs-dev (9)
- # clojure (67)
- # clojure-europe (4)
- # clojure-france (4)
- # clojure-germany (2)
- # clojure-italy (3)
- # clojure-nl (10)
- # clojure-uk (62)
- # clojurescript (11)
- # clojurex (3)
- # conjure (77)
- # cursive (16)
- # datomic (105)
- # docker (4)
- # editors (3)
- # events (5)
- # fulcro (34)
- # jobs (1)
- # juxt (7)
- # kaocha (7)
- # lambdaisland (3)
- # lein-figwheel (2)
- # leiningen (19)
- # malli (14)
- # meander (6)
- # mid-cities-meetup (6)
- # off-topic (20)
- # pedestal (2)
- # reagent (17)
- # reitit (7)
- # remote-jobs (1)
- # shadow-cljs (17)
- # spacemacs (23)
- # specter (2)
- # tools-deps (34)
How would I rewrite a single vector in an arbitrarily nested vector? I want to add some properties to a Malli schema.
(me/rewrite '[:A
[:B [:C 1 2] [:C 3 [:D 4 5]]]
[:B [:C 6 7] [:C 8 [:D 9 10]]]]
(me/$ ?loc [:D 4 5 :as ?D])
(me/$ ?loc [:D YOU WIN]))
;; =>
[:A
[:B [:C 1 2] [:C 3 [:D YOU WIN]]]
[:B [:C 6 7] [:C 8 [:D 9 10]]]]
Or like @U5K8NTHEZ said, you can use strategies.
I found out that there is an updating function built in so I went with that in the end.
👍 4
Strategies are the best thing we have for this right now.