Also good to know that
as-> is made to be nested inside
->. That’s why it takes the symbol as its second arg.
Oh and, what you did is called an anaphoric macro: https://en.m.wikipedia.org/wiki/Anaphoric_macro
And I don’t recommend you use the
% symbol for the anaphore. It’ll clash with its use inside short lambda notation
#(* % %). Normally
<> are more common choices as anaphore.
That said, technically, any choice could have a conflict, which is why you generally want to limit the number of anaphoric macros you write, and instead offer a choice of the symbol to the user as an argument.
Another downside is that each anaphoric macro can mean you need to remember what secret symbols it uses, which is why people tend to stick to common ones like
For your use case though, I think people do, I’ve seen a few
-<> arrow macros in the wild, and I personally use the latter one. It’s nice for non nested cases, or use inside a