meander 2024-12-04

(into {}
  (m/search {:a {:x 1} :b {:x 2} :c {:x 3}}
            {?k {:x ?v}}
            [?k ?v]))
It seems like an easy question, but I'm struggling. Can I do without into?

(m/rewrite
    {:a {:x 1} :b {:x 2} :c {:x 3}}
    {& (m/seqable [!k {:x !v}] ...)}
    {& (m/seqable [!k !v] ...)})

👍 1

Maybe I was too simplified the example. What if data contains another map without :x ? for example:

IN: {:a {:x 1} :b {:x 2} :c {:x 3} :d {:y 4}, :e {}}
OUT: {:a 1, :b 2, :c 3}
I have a feeling I should use gather or some, but it's not easy...