multi sub infix:<*>( Numeric $i, Block $b ) { &$b($_) for ^($i.Int); }
3 * { .say };
Yields
Useless use of "*" in expression "3 * { .say }" in sink context
How do I get rid of that and make my operator work? I know I could assign it to $
or something else, but I don't want that.
Add this line to the start of your code:
proto sub infix:<*> ( | --> Nil ) {*}
See my answer to Impossible to put a map in sink context for a little on the --> Nil
part of this (along with a boatload of irrelevant stuff too) including Larry's 2012 comment:
--> Nil
seems like pretty good documentation of a procedure done only for its side-effects
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