(m/rewrite {:a 'a :b nil}
{:a ?a & (m/gather [!k (m/some !v)])}
{:a ?a & [[!k !v] ...]})
;; =>
{:a a}
(m/rewrite {:a 'a :b nil :c 'c :d nil}
{:a ?a & (m/gather [!k (m/some !v)])}
{:a ?a & [[!k !v] ...]})
;; =>
{:a a, :c c}
You can use m/gather for this kind (it works the best for memory variables).
That pattern is the same as writing
{:a ?a & (m/seqable (m/or [!k (m/some !v)] _) ...)}
More verbosely
(m/rewrite {:a 'a :b nil :c 'c :d nil}
{?k nil & (m/cata ?m)}
?m
{?k ?v & (m/cata ?m)}
{?k ?v & ?m}
{}
{})
;; =>
{:a a, :c c}
Pattern match on the ?k nil first.