You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/Language/operators.pod6
+20-9Lines changed: 20 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1529,33 +1529,43 @@ if C<$a eqv $b>, then C<$a cmp $b> always returns C<Order::Same>.
1529
1529
1530
1530
=head2infix C<coll>
1531
1531
1532
-
Defined as:
1532
+
Defined asN<These are not yet implemented in the JVM>:
1533
1533
1534
1534
multi sub infix:<coll>(Str:D \a, Str:D \b --> Order:D)
1535
1535
multi sub infix:<coll>(Cool:D \a, Cool:D \b --> Order:D)
1536
-
multi sub infix:<coll>(Pair:D \a, Pair:D \b)
1537
-
multi sub infix:<coll>(Str:D \a, Str:D \b)
1536
+
multi sub infix:<coll>(Pair:D \a, Pair:D \b --> Order:D)
1538
1537
1539
-
C<coll> is a sorting operator that takes pairs of C<Str>s, C<Cool>s or C<Pair>s and returns an C<Order> that uses the C<$*COLLATION> order. The default behavior disregards diacritic marks and capitalization, for instance.
1538
+
C<coll> is a sorting operator that takes pairs of C<Str>s, C<Cool>s or C<Pair>s
1539
+
and returns an C<Order> that uses the C<$*COLLATION> order. The default behavior
1540
+
disregards diacritic marks and capitalization, for instance.
1540
1541
1541
1542
say "b" cmp "à"; # OUTPUT: «Less»
1542
1543
say "b" coll "à"; # OUTPUT: «More»
1543
1544
1544
-
In the first case, lexicographic or codepoint order is taken into account. In the second, which uses C<coll>, the diacritic is not considered and sorting happens according to intuitive order.
1545
+
In the first case, lexicographic or codepoint order is taken into account. In
1546
+
the second, which uses C<coll>, the diacritic is not considered and sorting
1547
+
happens according to intuitive order.
1545
1548
1546
1549
=head2infix C«unicmp»
1547
1550
1551
+
Defined asN<These are not yet implemented in the JVM>:
1552
+
1548
1553
multi sub infix:<unicmp>(Str:D \a, Str:D \b --> Order:D)
1549
-
multi sub infix:<unicmp>(Pair:D \a, Pair:D \b)
1554
+
multi sub infix:<unicmp>(Pair:D \a, Pair:D \b --> Order:D)
1555
+
multi sub infix:<coll>(Pair:D \a, Pair:D \b --> Order:D)
1550
1556
1551
1557
Unlike the cmp operator which sorts according to codepoint, C<unicmp> and
1552
-
C<coll> sort according to how most users would expect, that is, disregarding aspects of the particular character like capitalization.
1558
+
C<coll> sort according to how most users would expect, that is, disregarding
1559
+
aspects of the particular character like capitalization.
1553
1560
1554
1561
say 'a' unicmp 'Z'; # Less
1555
1562
say 'a' coll 'Z'; # Less
1556
1563
say 'a' cmp 'Z'; # More
1557
1564
1558
-
The main difference between C<coll> and C<unicmp> is that the behavior of the former can be changed by the L<C<$*COLLATION>|/language/experimental#index-entry-%24%2ACOLLATION-%24%2ACOLLATION> dynamic variable.
1565
+
The main difference between C<coll> and C<unicmp> is that the behavior of the
0 commit comments