> On 11 Dec 2017, at 04:42, Sean McAfee wrote:
>
> I think of %% as being Perl 6's is-divisible-by operator, so I was a little
> surprised to discover this behavior:
>
> > 1 %% 0
> Attempt to divide 1 by zero using infix:<%%>
> in block at line 1
>
> The docs say a %% b
On Mon, Dec 11, 2017 at 1:52 AM, Elizabeth Mattijsen wrote:
> > On 11 Dec 2017, at 04:42, Sean McAfee wrote:
> > The docs say a %% b is True if a % b is 0, so the error is as-designed,
> at least. But mightn't it make more sense for %% to just return False
I think that this stems from a confusion between the divisibility problem
in integer number (on a ring) and the divisibility problem resolved by the
perl6 %% operator.
Personally I think that %% is useless while the former is useful and
missing. But I have nothing against useless operators
On
Putting aside the edge case of what to do when the divisor is zero, which could
also be tested for prior to attempting to call the operator:
An "is evenly divisible by" operator is an immensely useful one to have built-in
to the language; not only is "x %% y" much more direct to the real
On Mon, Dec 11, 2017 at 3:01 PM, wrote:
>
> On 2017-12-11 12:22 PM, Sean McAfee wrote:
>
>> Well, not really. I don't think x %% 0 should return a Failure at all.
>>
>
> Is there a particular problem the current implementation fails to solve?
> In boolean
> context `x %% 0`
not what you think:
module operator in % in perl6 is defined as $b - $a * floor($b / $a)
On Mon, Dec 11, 2017 at 10:37 PM, Sean McAfee wrote:
> On Mon, Dec 11, 2017 at 12:56 PM, Darren Duncan
> wrote:
>
>> On 2017-12-11 12:22 PM, Sean McAfee wrote:
On 2017-12-11 12:22 PM, Sean McAfee wrote:
Well, not really. I don't think x %% 0 should return a Failure at all.
Is there a particular problem the current implementation fails to
solve? In boolean
context `x %% 0` *is* equivalent to False. The Failure carries
additional information
to
On 2017-12-11 5:21 PM, Sean McAfee wrote:
Well, /any/ function or operator that returns a boolean /could/ return a Failure
instead of (or in addition to) False to provide additional information to those
who want it, but if the condition is not really a Failure, wouldn't that be
misleading? Like