File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,10 @@ Defined as:
130
130
131
131
method antipairs(Map:D:) returns Seq:D
132
132
133
+ Usage:
134
+
135
+ MAP.antipairs
136
+
133
137
Returns all keys and their respective values as a L < Seq|/type/Seq > of C < Pair > s
134
138
where the keys and values have been exchanged, i.e. the opposite of method
135
139
L < pairs|#method_pairs > . Unlike the L < invert|#method_invert > method, there is
@@ -142,13 +146,19 @@ no attempt to expand list values into multiple pairs.
142
146
143
147
Defined as:
144
148
145
- method invert(Map:D:) returns List :D
149
+ method invert(Map:D:) returns Seq :D
146
150
147
151
Usage:
148
152
149
153
MAP.invert
150
154
151
- Returns a list of pairs, but with key and value exchanged.
155
+ Returns all keys and their respective values as a L < Seq|/type/Seq > of C < Pair > s
156
+ where the keys and values have been exchanged. The difference between C < invert >
157
+ and L < antipairs|#method_antipairs > is that C < invert > expands list values into
158
+ multiple pairs.
159
+
160
+ my $m = Map.new('a' => (2, 3), 'b' => 17);
161
+ say $m.invert; # (2 => a 3 => a 17 => b)
152
162
153
163
= head2 method kv
154
164
You can’t perform that action at this time.
0 commit comments