On Fri Jan 30 20:20:04 2009, s1n wrote: > On Wed Dec 17 15:38:07 2008, masak wrote: > > <masak> rakudo: say (1,2,3) ~~ (1,*,*,3) > > <p6eval> rakudo 34053: OUTPUT[0] > > If my understanding of how whatever-star works is right, this test isn't > entirely correct. What you probably meant to test was this: > > (22:16:24) s1n: rakudo: (1,2,3) ~~ (1,*,*,3) > (22:16:28) p6eval: rakudo 36183: RESULT«Bool::False» > (22:16:59) s1n: rakudo: (1,2,3) ~~ (*,*,3) > (22:17:03) p6eval: rakudo 36183: RESULT«Bool::False» > (22:17:25) s1n: rakudo: (1,2) ~~ (1,*) > (22:17:28) p6eval: rakudo 36183: RESULT«Bool::True» > > Notice the 1 test is checking if a 3 element list against a 4 element > list. The second test shows that the multiple whatever-stars still don't > work. The last test is just gravy showing that at least 1 whatever-star > works correctly.
I've had similar thoughts when trying to grok the whatever star, and my conclusion contradicts your above comment. Here's why: Currently, one of the established uses of the whatever star in smartmatching is checking whether an item is an element of an array. S03:3323 gives this example: Array Num array contains number *,X,* To me, this establishes that the whatever star also matches zero-width subsequences of the array. Because if it didn't, the above wouldn't match an array containing the element in the beginning or in the end. With this logic (that the whatever star matches zero elements), all three of your smartmatches should evaluate to true.