develooper Front page | perl.perl6.language | Postings from July 2010

Re: Suggested magic for "a" .. "b"

Thread Previous | Thread Next
From:
Ruud H.G. van Tol
Date:
July 17, 2010 05:59
Subject:
Re: Suggested magic for "a" .. "b"
Message ID:
4C41A928.1020606@isolution.nl
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}>'
Ac
Ad
Ae
Bc
Bd
Be


> Currently, Rakudo produces this:
> 
> "Ab", "Ac", "Ad", "Ae", "Af", "Ag", "Ah", "Ai", "Aj", "Ak", "Al", "Am",
> "An", "Ao", "Ap", "Aq", "Ar", "As", "At", "Au", "Av", "Aw", "Ax", "Ay",
> "Az", "Ba", "Bb", "Bc", "Bd", "Be"
> 
> which I don't think is terribly useful.

Good enough for me. For your variant, just override the .. for 'smarter' 
behavior?

-- 
Ruud


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About