Perl6 中 "one" 联结的逻辑问题
Logical problem with "one" junction in Perl6
我在 .one 交汇点和范围匹配方面遇到了一些问题:
> 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)
>
我错过了什么?我在 MoarVM 上使用 Rakudo Star 2018.10,实现 Perl6.c.
我认为潜在的问题是:
$ perl6 -e 'dd (0,3).one ~~ (1 .. 9)'
one(Bool::True, Bool::True)
应该是one(Bool::False, Bool::True)
。我认为这是一个错误,值得提出一个问题。
我在 .one 交汇点和范围匹配方面遇到了一些问题:
> 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)
>
我错过了什么?我在 MoarVM 上使用 Rakudo Star 2018.10,实现 Perl6.c.
我认为潜在的问题是:
$ perl6 -e 'dd (0,3).one ~~ (1 .. 9)'
one(Bool::True, Bool::True)
应该是one(Bool::False, Bool::True)
。我认为这是一个错误,值得提出一个问题。