meander 2023-04-19

I am trying to get back to meander after almost two and I do not understand my own code 🙃

Can someone remind me if values can be skipped?

simplest example, let's say, I wouldn't want that nil

(me/rewrite [{:a 1} {:b 2}]
  {:b ?v} ?v
  [?x & ?more] [(me/cata ?x) & (me/cata ?more)]
  ?x ?x)
;; => [nil 2]

I know I can filter it with one more cata, but I'm trying to recall if there is an easier way

Wrap the v in a some?

Of course, it doesn't work because the pattern needs something to match

(me/rewrite [{:a 1} {:b 2}]
  {:b (me/some ?v)} ?v
  [?x & ?more] [(me/cata ?x) & (me/cata ?more)]
  )
;; => nil

(me/rewrite [{:a 1} {:b 2}]
  {:b (me/some ?v)} ?v
  [?x & ?more] [(me/cata ?x) & (me/cata ?more)]
  ?x ?x)
;; => [{:a 1} 2]

I am where I was before, but instead of nil I have the entire map 🙂

😂 1

@huxley What were you after in this case?

i already managed this, I rediscovered m/$