Re: A nice touch

2021-11-04 Thread Laurent Rosenfeld via perl6-users
It is the exponentiation operator: $ perl -E 'say 3 ** 2;' 9 Cheers, Laurent. Le mer. 3 nov. 2021 Γ  20:05, Wes Peng 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 w

Re: A nice touch

2021-11-03 Thread Wes Peng
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 wrote: > Recently I was golfing the "hyperfactorial," defined for a number 𝑛 as > 𝑛**𝑛 Γ— (𝑛-1)**(𝑛-1) Γ— (𝑛-2)**(𝑛-2) Γ— ... Γ— 1. I created a

Re: A nice touch

2021-10-31 Thread Ralph Mellor
On Mon, Nov 1, 2021 at 2:38 AM Ralph Mellor wrote: > > `R` reverses associativity, which is *another* way that `R` is a > nicely designed metaoperator, though this latter aspect is not > relevant to why it worked for the solution you came up with? Ah no. Of course it has to do the reversal or it

Re: A nice touch

2021-10-31 Thread Ralph Mellor
On Sun, Oct 31, 2021 at 6:10 PM Sean McAfee wrote: > > the main point of my message was about the R metaoperator and the > associativity of the operator it creates. OK. Fwiw this was something I didn't know, or had forgotten, and I find it delightful. The main point of *my* comment was that I d

Re: A nice touch

2021-10-31 Thread Sean McAfee
On Sat, Oct 30, 2021 at 9:21 PM Wes Peng wrote: > What's the "**" operator in perl? I most of the time use R for math, not > familiar with this operation. > It's exponentiation: https://docs.raku.org/language/operators#infix_** That wasn't a Raku expression I used it in, though, just my attempt

Re: A nice touch

2021-10-31 Thread Sean McAfee
On Sat, Oct 30, 2021 at 9:03 PM Ralph Mellor wrote: > On Sat, Oct 30, 2021 at 8:38 PM Sean McAfee wrote: > > Anyway, pretty cool! > > I agree it's cool, at least in a golfing sense. > > But is your explanation right? > > The *range* operator (`..`), if the rhs is less than the left, > yields an

Re: A nice touch

2021-10-30 Thread Ralph Mellor
On Sat, Oct 30, 2021 at 8:38 PM Sean McAfee wrote: > > It worked! But I couldn't quite see how. > > Anyway, pretty cool! I agree it's cool, at least in a golfing sense. But is your explanation right? The *range* operator (`..`), if the rhs is less than the left, yields an empty list rather tha

A nice touch

2021-10-30 Thread Sean McAfee
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