This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-09
Channels
- # announcements (9)
- # beginners (69)
- # cider (4)
- # clj-kondo (8)
- # cljdoc (1)
- # clojure (52)
- # clojure-austin (4)
- # clojure-europe (22)
- # clojure-nl (2)
- # clojure-norway (14)
- # clojure-uk (3)
- # clojurescript (9)
- # conjure (4)
- # cursive (3)
- # datalevin (13)
- # datomic (4)
- # events (2)
- # fulcro (59)
- # graalvm (17)
- # helix (25)
- # inf-clojure (4)
- # integrant (4)
- # introduce-yourself (2)
- # java (5)
- # kaocha (1)
- # leiningen (3)
- # meander (7)
- # nbb (4)
- # off-topic (30)
- # portal (4)
- # rdf (1)
- # reagent (5)
- # sci (1)
- # shadow-cljs (57)
- # sql (8)
- # tools-deps (39)
- # uncomplicate (3)
- # vim (3)
- # xtdb (8)
heya. just starting to wrap my mind around meander, and it’s been pleasant so far. can someone point out my mistake here, please? I had hoped that the following two snippets (🧵) would to the same, but they don’t. I’m exploring rewrites
.
(defn process-suites [benchmarks]
(m/rewrites {:bench benchmarks}
{:bench (m/scan {:Version ?v
:Date ?d
:Suites (m/scan {:Pkg ?pkg
:Benchmarks (m/scan {:Name ?name
:NsPerOp ?ns_per_op})})})}
{:version ?v :date ?d :pkg ?pkg :name ?name :ns_per_op ?ns_per_op}))
(defn process-suites0 [benchmarks]
(m/rewrites benchmarks
[{:Version !v
:Date !d
:Suites [{:Pkg !pkg
:Benchmarks [{:Name !name
:NsPerOp !ns_per_op} ...]} ...]} ... ]
[{:version !v :date !d :pkg !pkg :name !name :ns_per_op !ns_per_op} ...]))
the first does the trick, the second one returns nil
when called on the data
m/scan
isn't equivalent to what you have below. scan
looks for anything that matches and will skip over mismatches. Your below example requires that everything match.
thanks for your reply. example data would be https://github.com/bobheadxi/gobenchdata/blob/gh-pages/benchmarks.json
the records are homogeneous, there are no missing fields