Fork me on GitHub
#meander
<
2021-09-28
>
wilkerlucio19:09:32

hello, I’m looking for some operation to sub match, I’m not sure if there is one, but if it existed I expected to working something like this:

(def items
  {1 {:a "a"
      :b "b"}})

(m/find {:id 1}
  {:id (m/sub-match (m/app items ?item)
         {:a ?a})}
  ?a)

wilkerlucio19:09:42

is there an operator or way to do that?

wilkerlucio19:09:02

in terms of text, I want to extract some data point, get over a fn (using m/app) and them match again over that result

ribelo20:09:27

@U066U8JQJ every problem can be solved with a finite number of m/cata

ribelo20:09:48

(def items
  {1 {:a "a"
      :b "b"}})

(m/rewrite {:id 1}
  {:id (m/app items ?item)}
  (m/cata [:sub-match ?item])
  [:sub-match ?x]
  [:after-sub-match ?x])

jgdavey20:09:12

Sometimes, I also shove more information into the data structure in question. In your case, it looks a little like a join.

wilkerlucio12:09:32

nice! the integrated index solution is neat 🙂