We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 880edf3 commit 0ee3245Copy full SHA for 0ee3245
doc/Type/List.pod6
@@ -194,6 +194,20 @@ values, i.e. the direct opposite to L<pairs|/type/List#routine_pairs>.
194
195
say <a b c>.antipairs; # OUTPUT: «(a => 0 b => 1 c => 2)»
196
197
+=head2 routine invert
198
+
199
+Defined as:
200
201
+ method invert(List:D: --> Seq:D)
202
203
+Assumes every element of the List is a C<Pair>. Returns all elements as a
204
+L<Seq|/type/Seq> of C<Pair>s where the keys and values have been exchanged.
205
+If the value of a C<Pair> is an C<Iterable>, then it will expand the values
206
+of that C<Iterable> into separate pairs.
207
208
+ my $l = List.new('a' => (2, 3), 'b' => 17);
209
+ say $l.invert; # OUTPUT: «(2 => a 3 => a 17 => b)»
210
211
=head2 routine join
212
213
Defined as:
0 commit comments