This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-13
Channels
- # announcements (2)
- # architecture (10)
- # aws (1)
- # babashka (1)
- # beginners (208)
- # calva (15)
- # clojure (164)
- # clojure-australia (9)
- # clojure-europe (37)
- # clojure-nl (19)
- # clojure-sanfrancisco (2)
- # clojure-spec (10)
- # clojure-taiwan (2)
- # clojure-uk (48)
- # clojurescript (59)
- # conjure (2)
- # core-async (3)
- # data-science (3)
- # datomic (5)
- # events (66)
- # figwheel-main (2)
- # fulcro (35)
- # graphql (3)
- # jobs-rus (3)
- # kaocha (1)
- # meander (5)
- # off-topic (85)
- # pedestal (2)
- # re-frame (5)
- # reitit (11)
- # reveal (5)
- # shadow-cljs (16)
- # slack-help (15)
- # test200 (4)
- # tools-deps (12)
- # xtdb (9)
would appreciate any suggestions on simplifying or otherwise improving this rewrite, first time really trying to do anything with cata
and memory variables: https://github.com/casselc/dmarc/blob/4ce96be48367381d8983b2082174213ebf848725/src/casselc/dmarc.clj#L30
Overall things look pretty good. Are there any things you are running into trouble with?
A couple things I’d change from my quick glance.
1. Instead of (m/app merge map1 (m/cata !record))
you can do {:my-keys :my-vals & (m/cata !record)}
2. Sprinkle in some (m/some)
. Meander doesn’t actually check that keys exist in maps by default.
(m/rewrite {:a 2}
{:record _ :as !record}
[!record ...])
;; => [{:a 2}]
(m/rewrite {:a 2}
{:record (m/some) :as !record}
[!record ...])
;; => nil
If there is anything that isn’t working how you expect, definitely let us know and we can help.thanks, the merge
was making my eye twitch a little:slightly_smiling_face: - as best I can tell it's working correctly at the moment, although it took longer than I care to admit to get to this point. I mostly wanted to make sure I wasn't overly complicating anything or doing something boneheaded (like you pointed out with some
)
I think missing m/some
may have been why I couldn't get the {:spf}
pattern variants to work as memory variables instead of using cata
when I tried previously.
Also adding some
uncovered an issue where some providers are sending fields in a different order than the schema specifies and I was just silently ignoring some of the data, so thanks again.