相关疑难解决方法(0)

为什么Perl 6 REPL中没有新的运算符定义?

我在试验在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)

operators user-defined-functions perl6 read-eval-print-loop raku

13
推荐指数
1
解决办法
187
查看次数