Ruud H.G. van Tol wrote:
> Aaron Sherman wrote:
> 
>> Having established this range for each correspondingly indexed letter, the
>> range for multi-character strings is defined by a left-significant counting
>> sequence. For example:
>> 
>> "Ab" .. "Be"
>> 
>> defines the ranges:
>> 
>> <A B> and <b c d e>
>> 
>> This results in a counting sequence (with the most significant character on
>> the left) as follows:
>> 
>> <Ab Ac Ad Ae Bb Bc Bd Be>
> 
> glob can do that:
> 
> perl5.8.5 -wle 'print for <{A,B}{c,d,e}>'

Or Perl 6, for that matter :-)

> .say for <A B> X~ ('a' .. 'e')
Aa
Ab
Ac
Ad
Ae
Ba
Bb
Bc
Bd
Be

In general, stuffing more complex behaviour into something that feels
unintuitive is rarely (if ever) a good solution.

The current behaviour of the range operator is (if I recall correctly):

1) if both sides are single characters, make a range by incrementing
codepoints
2) otherwise, call .succ on the LHS. Stop before the generated values
exceed the RHS.

I'm not convinced it should be any more complicated than that. Remember
that with the series operator you can easily define your own
incrementation rules, and meta operators (like the cross meta operator
demonstrated above) it's also easy to combine different series and lists.

Cheers,
Moritz

Reply via email to