David Whipp wrote: > > First, a slight clarification: if I say: > > m:w/ %foo := [ (\w+) = (\w+) [ , (\w+) ]* ] / > > does this give me a hash of arrays? (i.e. is the rhs of a hash processed as > a scalar context)
That's an error. The grouping bound to a hypothetical hash has to have either exactly one or exactly two captures in it. To get what you want you'd need something like: rule wordlist { (\w+) [ , (\w+) ]* } m:w/ %foo := [ (\w+) = (<wordlist>) ] / or just: m:w/ %foo := [ (\w+) = ({ /(\w+) [ , (\w+) ]*/ }) ] / > When I look at this, I see a common pattern: the join/split concept. It > feels like there should be a standard assertion: These are good ideas for assertions. If they don't become standard, it will certainly be possible to write a module that makes them available. > And a question about <m,n> (I think something similar came up a few weeks > ago): why isn't it <m..n>, i.e. a list of the numbers of matches allowed. > This seems to be the only place in perl6 where a list of numbers, as a > range, isn't constructed using the .. operator. Because a <m,n> isn't a list of numbers. It's the lower and upper bounds on a repetition count. Damian