meander

2023-04-19T12:45:16.801589Z

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

2023-04-19T12:46:03.585289Z

Can someone remind me if values can be skipped?

2023-04-19T12:47:08.831329Z

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]

2023-04-19T12:48:52.055679Z

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

Ben Sless 2023-04-19T15:08:59.834569Z

Wrap the v in a some?

2023-04-19T20:23:12.292009Z

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

2023-04-19T20:23:31.562419Z

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

2023-04-19T20:24:02.277969Z

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

2023-04-19T20:25:08.052209Z

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

😂 1
noprompt 2023-04-19T23:16:28.002049Z

@huxley What were you after in this case?

2023-04-19T23:17:46.596659Z

nice to see you again @noprompt

2023-04-19T23:17:48.828069Z

🙂

noprompt 2023-04-19T23:24:10.596459Z

🙂

2023-04-19T23:33:05.876429Z

i already managed this, I rediscovered m/$