Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (33 sloc) 1.391 kb
use v6;
my @alphabets;
push @alphabets, [ord('0')..ord('9')];
push @alphabets, [ord('A')..ord('Z')];
push @alphabets, [ord('a')..ord('z')];
# avoid FINAL SIGMAs for Greek
push @alphabets, [grep * != 0x3a2, ord('Α')..ord('Ω')];
push @alphabets, [grep * != 0x3c2, ord('α')..ord('ω')];
push @alphabets, [ord('')..ord('')]; # clock roman uc (U+2160..U+216b)
push @alphabets, [ord('')..ord('')]; # clock roman lc
push @alphabets, [ord('')..ord('')]; # circled digits (U+2460..U+2473)
push @alphabets, [ord('')..ord('')]; # parenth digits (U+2474..U+2487)
push @alphabets, [ord('')..ord('')]; # parenth lc (U+249c..U+24b5)
push @alphabets, [ord('')..ord('')]; # die faces (U+2680..U+2685)
push @alphabets, [map &ord, "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン".comb];
my @ranges;
for @alphabets -> $r {
say "$r is out of order!" unless [<] @$r;
my $last = $r[*-1];
my $first = $r[0];
while @$r {
my @range = shift($r);
push @range, shift($r) while $r && $r[0] == @range[*-1]+1;
push @ranges, [
@range[0],
@range[*-1],
$last,
$r ?? $r[0] !! $first
];
$last = @ranges[*-1][1];
}
}
say @ranges.sort(*[0] - *[1]).map(*.list).join(", ");
Jump to Line
Something went wrong with that request. Please try again.