Dan*_*ita 13 operators user-defined-functions perl6 read-eval-print-loop raku
我在试验在Perl 6 REPL上定义运算符时遇到了问题,并注意到它们确实有效,但只有在它们被定义的同一行上使用时才会有效.为什么会这样?
> sub postfix:<!>(Int $x where { $x >= 0 }) { [*] 1..$x }; 6!;
720
> 6!;
===SORRY!=== Error while compiling:
Negation metaoperator not followed by valid infix
------> 6!?;
expecting any of:
infix
infix stopper
Run Code Online (Sandbox Code Playgroud)