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.
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
(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
best provide your input 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.