@snoe Can we generate a release from the last PR merged 🙂 ?
🎉
Thanks! 🎉
Hey @snoe, we from :nubank: have a custom macro for testing and we can't create a macro-def for it, can you help us please?
this is the macro:
Sample structure:
(flow "Test flow"
(side-effect!)
[binding-a (fetch-a!)]
(match? x binding-a)
[binding-b (fetch-b!)])
Example2:
(flow test-x
[a 1
b 2]
[c 3
d 4
:let [abcd (some-func/abcd)
dcba (another-func a b) ]]
(some-test/do-something a b c d)
[some-value 1234]
(my-fn/match? 2 (count some-value))
(my-fn/match? (m/in-any-order [a b]) some-value))
in the body, we can have many fn that apply to the state and we may bind the result to a name. Calling the function as in `(side-effect!)` will only apply to the state and skip the return. using `[name (fn!)]` will bind the result to the name. And we can still have `match?` in the middle of the forms. Finally, there is `[:let [name val]]` that will bind without as a usual `let`
The problem to me is that it can have multiple bindings
I tried something like:
my-ns/defflow [{:element :declaration :tags #{:unused}}
{:element :bindings :pred :vector :repeat true}
:bound-elements]
But It seems that :pred
does not accept :vector
Also, I don't know if there's some :pred
for a function or something like that
yeah, seems like you need a :vector
and :list
preds but I think you'll also run into repeat not working as you expect
yes, I tried to add on match-pred?
and clojure-lsp enters in a loop and wont even start 😢
there is match-patterns
but It's been awhile since i made it and it ended up not being used so it'll need to be reverse engineered a bit
hrm, yeah, starting with a test there would be the way I approach it. but there could be assumptions about lists in that code
Yeah, that parse-match-patterns
is pretty complex 😨
right, macros that don't follow established patterns are always going to be tricky. kondo is thinking about using a sexpr that evals the pattern in some way.
That could help maybe