If I have the following program in raku it works well:
trabajando-en-piensa-en-raku on master [?] via 💎 v2.6.5
❯ cat factorial.raku
sub factorial( $n ) {
[*] 1 .. $n;
}
sub postfix:<!>( $n ) {
[*] 1 .. $n;
}
my $n = 5;
say "El factorial de $n es {factorial $n}";
say "Si calculamos $n! obtenemos {$n!}";
trabajando-en-piensa-en-raku on master [?] via 💎 v2.6.5
❯ raku factorial.raku
El factorial de 5 es 120
si calculamos 5! obtenemos 120
But if I define this functions in the raku REPL I get:
> * * &factorial
> 5
> El factorial de 5 es 120
It works normally and as expected for the factorial function, but I get this for the ! operator:
> * * &postfix:<!>
> ===SORRY!=== Error while compiling:
Negation metaoperator not followed by valid infix
------> say "Si calculamos $n! obtenemos {$n!⏏}";
expecting any of:
infix
infix stopper
I need an special sintax in order to define operators in raku REPL, or is depending how the environment is loaded.
I'm using In OSX Catalina
trabajando-en-piensa-en-raku on master [?] via 💎 v2.6.5
❯ rakubrew versions
system
moar-2020.07
* moar-2020.08.2