It is the exponentiation operator: $ perl -E 'say 3 ** 2;' 9
Cheers, Laurent. Le mer. 3 nov. 2021 Γ 20:05, Wes Peng <w...@coakmail.com> a Γ©crit : > What's the "**" operator in perl? I most of the time use R for math, not > familiar with this operation. > > Thanks > > On Sun, Oct 31, 2021 at 3:38 AM Sean McAfee <eef...@gmail.com> wrote: > >> Recently I was golfing the "hyperfactorial," defined for a number π as >> π**π Γ (π-1)**(π-1) Γ (π-2)**(π-2) Γ ... Γ 1. I created a quite >> concise Raku function: >> >> { [*] [\*] $_...1 } >> >> The only problem was that this function returns zero for a zero input, >> whereas the hyperfactorial of 0 is supposed to be 1. Of course I could >> have just handled zero as a special case, but I hoped to find something >> comparably short. After a bit of thought I tried reversing both the range >> and the operator: >> >> { [*] [\R*] 1..$_ } >> >> It worked! But I couldn't quite see how. * is commutative, so isn't it >> exactly the same as R*? >> >> It turns out, in Raku it isn't quite the same. On the operators page, I >> found that the R metaoperator produces an operator that reverses the order >> of the arguments, but *also* has the opposite associativity. So, for >> example, [\R*] 1..4 reduces from the right, producing the list (4, 12, 24, >> 24). Somehow I had formed the idea that Raku operators are left-, right-, >> or list-associative, but I was wrong. >> >> Anyway, pretty cool! >> >>