On 4/26/06, Joe Gottman <[EMAIL PROTECTED]> wrote:
> According to Synopsis 5, the repetition qualifier is now **{.} where the .
> must correspond to either an Int or a Range.  This seems rather restrictive.
> Why are we not allowed a junction of Ints, for instance

S05 also says:
<quote>
It is illegal to return a list, so this easy mistake fails:
     / [foo]**{1,3} /
(At least, it fails in the absence of use rx :listquantifier, which is
likely to be unimplemented in Perl 6.0.0 anyway).
</quote>

So it seems only reason not to allow lists is that they aren't yet
implemented, and likely won't be for some time.

> Also, I don't know exactly what the syntax looks like, but I can imagine
> using a repetition qualifier that takes a closure of some sort, for instance
> to match an odd number of repetitions
> m/^ a**{($_ % 2 == 0)} $/; #I'm not sure about the syntax for the code.

Are you reading some old version of S05?
http://dev.perl.org/perl6/doc/design/syn/S05.html says that "The
repetition specifier is now **{...} for maximal matching, with a
corresponding **{...}? for minimal matching. Space is allowed on
either side of the asterisks. The curlies are taken to be a closure
returning an Int or a Range object. "

So you can just put any closure which returns Int or Range directly
within the curlies.

--
Markus Laire

Reply via email to