meander

wilkerlucio 2021-09-28T19:39:32.115300Z

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)

wilkerlucio 2021-09-29T12:54:32.117400Z

nice! the integrated index solution is neat šŸ™‚

wilkerlucio 2021-09-28T19:39:42.115400Z

is there an operator or way to do that?

wilkerlucio 2021-09-28T19:40:02.115600Z

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

2021-09-28T20:04:27.116300Z

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

2021-09-28T20:09:48.116500Z

(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])

jgdavey 2021-09-28T20:21:10.116700Z

šŸ‘ 1
jgdavey 2021-09-28T20:21:12.117100Z

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