I am trying to define '!' as the factorial operator. The following works
in a .raku script file:
sub postfix:<!> ($n) is export {
when $n == 0 {return 1}
default {$n * ($n - 1)!}
}
However when I tried to move this sub to a .rakumod file, it produces an
error: Negation metaoperator not followed by valid infix.
It turns out that this is a known issue, #3774, with rakudo first
logged (AFAIK) in July 2020. Until this is fixed in some future release
of Rakudo, is there a workaround for this?
Note: I am using Rakudo v2022.07 on Ubuntu 20.04.5.
Thanks,
Joe