Skip to content

Commit 8c004e0

Browse files
committed
Left only the COLLATION here, refs #1979
1 parent 181c723 commit 8c004e0

File tree

1 file changed

+5
-42
lines changed

1 file changed

+5
-42
lines changed

doc/Language/experimental.pod6

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,56 +28,19 @@ not yet rendered properly.
2828
2929
=head1 Collation
3030
31-
Is available in release 2017.02. To use:
31+
The L<collate> and L<coll> are no longer experimental. However,
32+
these methods are affected by the X<B<$*COLLATION>|$*COLLATION>, which configures the four collation levels. While the Primary, Secondary and Tertiary mean different things for different scripts, for the Latin script used in English they mostly correspond with Primary being Alphabetic, Secondary being Diacritics and Tertiary being Case.
3233
33-
use experimental :collation;
34-
35-
Allows the use of the X<B<unicmp>|unicmp, Routine> and X<B<coll>|coll, method> operators.
36-
Also allows the use of the X<B<collate>|collate> method. unicmp and coll are like cmp, except
37-
it implements the Unicode Collation Algorithm.
38-
39-
B<coll> and the B<collate> method are affected by the X<B<$*COLLATION>|$*COLLATION>
40-
variable, while B<unicmp> is not.
41-
Unlike the cmp operator which sorts according to codepoint, B<unicmp> and
42-
B<coll> sort according to how most users would expect.
43-
44-
use experimental :collation;
45-
say 'a' unicmp 'Z'; # Less
46-
say 'a' cmp 'Z'; # More
47-
48-
B<coll> and the B<collate> method are both configurable by setting the
49-
B<$*COLLATION> variable.
50-
51-
=head2 collate (method)
52-
53-
You can use the collate method similar to how one would use the B<sort> method.
54-
55-
use experimental :collation;
56-
say ('a', 'Z').sort; # (Z a)
57-
say ('a', 'Z').collate; # (a Z)
58-
say <ä a o ö>.collate; # (a ä o ö)
59-
my %hash = 'aa' => 'value', 'Za' => 'second';
60-
say %hash.collate; # (aa => value Za => second);
61-
62-
=head2 Collation Levels
63-
64-
There are four collation levels which are all configurable.
65-
66-
While the Primary, Secondary and Tertiary mean different things for different
67-
scripts, for the Latin script used in English they mostly correspond with
68-
Primary being Alphabetic, Secondary being Diacritics and Tertiary being Case.
69-
70-
In the below example you can see how when we disable tertiary collation which in
34+
In the example below you can see how when we disable tertiary collation which in
7135
Latin script generally is for case, and also disable quaternary which breaks
7236
any ties by checking the codepoint values of the strings, we get B<Same> back
7337
for B<A> and B<a>:
7438
7539
use experimental :collation;
7640
$*COLLATION.set(:quaternary(False), :tertiary(False));
77-
say 'a' coll 'A'; # Same
41+
say ('a','A').collate == ('A','a').collate; # OUTPUT: «True␤»
7842
79-
B<Note the collation features, especially the $*COLLATION API could change
80-
at any time>
43+
The $*COLLATION API could change at any time, so use it with caution.
8144
8245
=end pod
8346

0 commit comments

Comments
 (0)