@@ -509,16 +509,27 @@ predecessors, and will fail if you run off of either end.
509
509
❶..❿ # dingbat negative circled 1..10
510
510
etc.
511
511
512
+ Note: for actual ranges in Perl you'll need to quote the characters above:
513
+
514
+ '⓪'..'㊿' # circled digits/numbers 0..50
515
+
512
516
If you want to future-proof the top end of your range against further
513
517
Unicode additions, you may specify it as "whatever":
514
518
515
- ⓪..* # circled digits/numbers up to current known Unicode max
519
+ '⓪'..* # circled digits/numbers up to current known Unicode max
520
+
521
+ Since these non-carrying ranges fail when they run out, it is
522
+ recommended that you avoid non-carrying rangechars where, for instance,
523
+ you need to keep generating unique filenames. It's much better to
524
+ generate longer strings via carrying rangechars in such cases.
525
+
526
+ Note that all character increments can be handled by lookup in a
527
+ single table of successors since we've defined our ranges not to overlap.
516
528
517
- (Note that we can't just increment unrecognized characters, because
529
+ Anyway, back to string increment. Only rangechars may be incremented;
530
+ we can't just increment unrecognized characters, because
518
531
we have to locate the string's final sequence of rangechars before knowing
519
- which portion of the string to increment. Note also that all character
520
- increments can be handled by lookup in a single table of successors
521
- since we've defined our ranges not to include overlapping cycles.)
532
+ which portion of the string to increment.
522
533
523
534
Perl 6 also supports C<Str> decrement with similar semantics, simply by
524
535
running the cycles the other direction. However, leftmost characters
@@ -2057,6 +2068,16 @@ Hence, to produce all octal numbers that fit in 16 bits, you can say:
2057
2068
2058
2069
'000000' ... '177777'
2059
2070
2071
+ At need, you can override these numeric codepoint semantics by using
2072
+ an explicit successor function:
2073
+
2074
+ '⓪', *.succ ... '㊿' # circled digits/numbers 0..50
2075
+
2076
+ (In fact, this is precisly what the translation from ranges does, in
2077
+ order to preserve the abstract ordering of rangechars that have
2078
+ non-contiguous codepoints. But it's easier just to use the range
2079
+ operator if that's the case.)
2080
+
2060
2081
If the start string is shorter than the stop string, the strings are
2061
2082
assumed to be right justified, and the leftmost start character is
2062
2083
duplicated when there is a carry:
0 commit comments