This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-02
Channels
- # announcements (5)
- # babashka (1)
- # beginners (140)
- # braveandtrue (1)
- # calva (28)
- # chlorine-clover (39)
- # cider (8)
- # clj-kondo (1)
- # cljfx (15)
- # cljs-dev (2)
- # clojure (41)
- # clojure-europe (39)
- # clojure-france (3)
- # clojure-germany (5)
- # clojurescript (28)
- # clr (1)
- # css (1)
- # cursive (3)
- # data-science (19)
- # fulcro (14)
- # graalvm (3)
- # hoplon (18)
- # jobs (2)
- # malli (7)
- # meander (2)
- # off-topic (10)
- # pathom (6)
- # re-frame (3)
- # reagent (2)
- # remote-jobs (1)
- # reveal (1)
- # shadow-cljs (5)
@tothda Does this do what you want?
(m/rewrite
db
{:items [!item ...] :labels ?labels}
{:items [(m/cata {::item !item ::labels ?labels}) ...]}
{::item {:id ?id :labels [!label ...]}
::labels ?labels}
{:id ?id :labels [(m/cata {::lookup-label [!label ?labels]}) ...]}
{::item {:id ?id :labels []}}
{:id ?id :labels []}
{::item {:id ?id}}
{:id ?id :labels []}
{::lookup-label [?label (m/scan {:id ?label :name ?name})]}
?name)
@markaddleman Yes! Thank you. I was not aware of (m/cata ...)
, and now with this approach I was able to replace a lot of ad-hoc data manipulation code. Amazing!
