meander

Joe 2022-09-11T12:06:20.291689Z

Hi! I'm planning to user Meander on the back and front end, with the back end passing the necessary pieces to the front, and then the front end turning those into a valid match expression So the back end would deliver something like this (edn format),

'{:name "test", :schema [:map [:a :int] [:b :int]], 
  :pattern {:a ?a, :b ?b}, 
  :target {:new-a ?a, :new-b ?b}}
And the front end turns that into a function
(fn [data] (e/match data {:a ?a, :b ?b} {:new-a ?a, :new-b ?b}))
Which could then be used. In the back end I can just create that form and evaluate it. But I don't think I can do that from the front. Is there a way I can get this to work? Or would it just be better to have the front end pass the data to the back and have Meander do the xforms there?

Joe 2022-09-15T13:42:15.776259Z

That's perfect, thanks!

Joe 2022-09-18T07:48:24.266059Z

@noprompt, out of interest, I can see in the interpreter namespace there's a finder, searcher, rewriter to match the main ns find, search, rewrite - is there a reason there isn't a matcher to go with the main ns match?

noprompt 2022-09-18T17:04:06.839649Z

Its been a while so I can't remember why I didn't add it. If I had to guess its probably because I was being lazy. 🙂

🤣 1
noprompt 2022-09-18T17:05:28.766549Z

It would basically amount to asking if a pattern is ambiguous.

IAmbiguous
(-ambiguous? [this context] ,,,) 

noprompt 2022-09-12T16:41:25.907969Z

There is an interpreter namespace which can take a quoted form an interpret it. It's cljc so it will work everywhere.