This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-17
Channels
- # adventofcode (56)
- # announcements (1)
- # aws (6)
- # beginners (127)
- # bristol-clojurians (1)
- # calva (29)
- # cider (7)
- # clj-kondo (37)
- # cljdoc (20)
- # cljsrn (7)
- # clojure (159)
- # clojure-europe (67)
- # clojure-italy (23)
- # clojure-nl (4)
- # clojure-provo (3)
- # clojure-uk (18)
- # clojurescript (19)
- # code-reviews (59)
- # community-development (105)
- # conjure (6)
- # core-async (16)
- # core-logic (1)
- # cursive (21)
- # datomic (19)
- # defnpodcast (1)
- # emacs (8)
- # events (2)
- # fulcro (71)
- # graalvm (23)
- # jobs-discuss (1)
- # kaocha (5)
- # luminus (5)
- # meander (16)
- # nrepl (32)
- # off-topic (6)
- # pathom (159)
- # pedestal (3)
- # reagent (14)
- # reitit (8)
- # reveal (12)
- # rewrite-clj (9)
- # shadow-cljs (169)
- # spacemacs (16)
- # specter (2)
- # sql (19)
- # tools-deps (36)
- # vim (6)
Hi, if I have two maps with similar nesting and keys, can I use specter to perform an operation on both simultaneously? For example, multiply values that have the exact same keys? Basically I'm looking for something like https://clojuredocs.org/clojure.core/merge-with but for an arbitrarily nested map
Here's an example:
{:price {"TSLA"
{"2020-11-01" 400
"2020-11-02" 425
"2020-11-03" 420
"2020-11-04" 430
"2020-11-05" 430}
"GOOG"
{"2020-11-01" 500
"2020-11-02" 525
"2020-11-03" 520
"2020-11-04" 530
"2020-11-05" 530}}}
{:weight {"TSLA"
{"2020-11-01" 0.5
"2020-11-02" 0.6
"2020-11-03" 0.3
"2020-11-04" 0.4
"2020-11-05" 0.7}
"GOOG"
{"2020-11-01" 0.4
"2020-11-02" 0.425
"2020-11-03" 0.420
"2020-11-04" 0.43
"2020-11-05" 0.43}}}
And my goal is to multiple :price
and :weight
together. How would I go about it with specter?