Cool.contains converts whatever it gets to a Str.  The Str representation of 
1..19 is:

  "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20"

As you can see, that string contains “0”, so the first iteration should return 
True (which it does).  So this is ENOTABUG as far as I’m concerned.

What you probably want is smart-match:

$ 6 'my $r = 1 .. 19; ( 0 .. 20 ).map: { ($_ ~~ $r).say }'
False
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
False


> On 24 Aug 2016, at 09:25, 刘刊 (via RT) <perl6-bugs-follo...@perl.org> wrote:
> 
> # New Ticket Created by  刘刊 
> # Please include the string:  [perl #129063]
> # in the subject line of all future correspondence about this issue. 
> # <URL: https://rt.perl.org/Ticket/Display.html?id=129063 >
> 
> 
> liukan@candor:~/Code$ cat foo
> my $r = 1 .. 19; ( 0 .. 20 ).map: { $r.contains( $_ ).say };
> 
> liukan@candor:~/Code$ perl6 foo
> True
> True
> True
> True
> True
> True
> True
> True
> True
> True
> True
> True
> True
> True
> True
> True
> True
> True
> True
> True
> False
> 

Reply via email to