The standard way to define a new operator in Raku is
multi sub infix:<operator> ($l, $r) { ... }
With different options instead of infix. I would like to define a custom meta operator, however. The closest I can come (matching the idea of @a X+ @b) is
multi sub prefix:<F> (&bar) { ... }
But while it compiles, the only way to get it to work with, e.g., the +
operator is to use an full identifier:
(F&infix:<+>)($a, $b)
Or are metaoperators definable?
You cannot currently define custom meta operators in Raku.
You might be able to get one to work through a slang, but with Rakudo-specifc code, and slangs aren't really well document -- the best you can do is google tutorials and examples, docs.raku.org is silent on them :-(
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With