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?That's perfect, thanks!
@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?
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. 🙂
It would basically amount to asking if a pattern is ambiguous.
IAmbiguous
(-ambiguous? [this context] ,,,)
There is an interpreter namespace which can take a quoted form an interpret it. It's cljc so it will work everywhere.