I am having some trouble with .one junction and range match:
> say (3,5).any ~~ (1 .. 9)
any(True, True)
> say so (3,5).any ~~ (1 .. 9)
True
> say so (3,5).one ~~ (1 .. 9)
False
> say so (3,0).one ~~ (1 .. 9) # expect True because 0 not in range and 3 is
False
> say so (3,0).any ~~ (1 .. 9)
True
> say so (0, 3).one ~~ (1..9) # expected True; 0 not in range; exactly one item (3) is in range
False
> so 0 ~~ 1..9 # as expected;
False
> so 3 ~~ 1..9
True
> say (0, 3).one ~~ (1..9) # unexpected; 0 not in range;
one(True, True) # expected one(False, True)
> say (1..9).elems
9
> say (0, 10).one ~~ (1..9) # why is it true that 0 ~~ 1..9 ??
one(True, False)
> say so (0, 10).one ~~ (1..9) # unexpected !!! neither 0 nor 10 in range
True
> say (-1, 3).one ~~ (1..9) # why -1 in range of 1..9 ??
one(True, True)
>
What am I missing? I am using Rakudo Star 2018.10 on MoarVM, implementing Perl6.c.
I think the underlying problem is this:
$ perl6 -e 'dd (0,3).one ~~ (1 .. 9)'
one(Bool::True, Bool::True)
That should be one(Bool::False, Bool::True)
. I think this is a bug, worthy of making an issue for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With