This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-01
Channels
- # announcements (1)
- # babashka (1)
- # beginners (49)
- # calva (111)
- # chlorine-clover (2)
- # cider (2)
- # circleci (9)
- # clojure (60)
- # clojure-europe (25)
- # clojure-nl (4)
- # clojure-taiwan (2)
- # clojure-uk (10)
- # code-reviews (5)
- # conjure (1)
- # cryogen (2)
- # cursive (1)
- # data-science (1)
- # datomic (1)
- # figwheel-main (1)
- # fulcro (23)
- # hoplon (2)
- # malli (4)
- # meander (1)
- # off-topic (149)
- # other-languages (1)
- # re-frame (40)
- # reagent (27)
- # reitit (2)
- # shadow-cljs (25)
- # slack-help (4)
- # spacemacs (7)
- # xtdb (11)
Hi! I'm trying to join two set of maps together. Basically the problem is exactly what is described in this SO question: https://stackoverflow.com/questions/63520565/a-declarative-way-of-reshaping-joining-flattening-data-in-nested-maps Is there a solution for it with meander? Thanks! I copy the relevant part here.
;; my input data
(def db {:items [{:id 1 :labels [1 2 3]}
{:id 2 :labels [2]}
{:id 3 :labels []}
{:id 4 :labels nil}
{:id 5 }]
:labels [{:id 1 :name "one"}
{:id 2 :name "two"}
{:id 3 :name "three"}
{:id 4 :name "four"}]})
;; what to do here
(defn flatten-labels [d]
???)
;; so that I get this
(flatten-labels db)
;; =>
;; {:items
;; [{:id 1 :labels ["one" "two" "three"]}
;; {:id 2 :labels ["two"]}
;; {:id 3 :labels []}
;; {:id 4 :labels []}
;; {:id 5 :labels []}]}