Is there a way in meander to not add a matched value to the result if it's nil?
IIRC m/some also works on rhs
How would that look like if I'm matching {:x ?x :y ?y} and want to rewrite as {:x ?x :y ?y} if ?y is some and {:x ?x} if not?
when I'm at the computer later, I'll take a look
(me/rewrite {:a 1 :b 2 :c 3}
{:a ?a :d ?d}
{& [[:aa ?a] ~(if ?d [:dd ?d])]})
unfortunately m/some does not work on rhs
and even worse, I am getting old because my memory is failing ; P
GOT IT
(m/rewrite {:a 'a :b nil}
{:a ?a :b ?b} {:a ?a & ~@(if ?b [[:b ?b]])})
Feels evil
will do it anyway
Even better:
(m/rewrite {:a 'a :b nil :c 3}
{:a ?a :b ?b :c ?c}
{:a ?a
& ~[(if ?b [:b ?b])
(if ?c [:c ?c])]})
Thanks borkdude, we now have a starting point