Skip to content

Commit 7faaaf9

Browse files
authored
Document Map.sort
1 parent 5629275 commit 7faaaf9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

doc/Type/Map.pod6

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,21 @@ Returns a C<Seq> of keys and values interleaved.
173173
174174
Map.new('a', 1, 'b', 2).kv # (a 1 b 2)
175175
176+
=head2 method sort
177+
178+
Defined as:
179+
180+
multi method kv(Map:D: --> Seq:D)
181+
182+
Returns a L<Seq> of L<Pair> objects, which are the pairs of the hash,
183+
sorted by key. Equivalent to C<%hash.sort: *.key>
184+
185+
# These are equivalent:
186+
say Map.new(<c 3 a 1 b 2>).sort; # OUTPUT: «(a => 1 b => 2 c => 3)␤»
187+
say Map.new(<c 3 a 1 b 2>).sort: *.key; # OUTPUT: «(a => 1 b => 2 c => 3)␤»
188+
189+
See L<Any.sort|/type/Any#method_sort> for additional available candidates.
190+
176191
=head2 method Int
177192
178193
Defined as:

0 commit comments

Comments
 (0)