File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -951,20 +951,21 @@ If it's a class, it will simply return Nil.
951
951
952
952
Defined as:
953
953
954
- multi method pairs(Any:U: -->List )
955
- multi method pairs(Any:D: -->List )
954
+ multi method pairs(Any:U:)
955
+ multi method pairs(Any:D:)
956
956
957
- Converts the invocant to a L < List|/type/List > via the C < list > method and returns
958
- the result of L < List.pairs|/type/List#routine_pairs > on it. Returns an empty
959
- L < List|/type/List > if the invocant is undefined:
957
+ Returns an empty
958
+ L < List|/type/List > if the invocant is a type object:
960
959
960
+ say Num.pairs; # OUTPUT: «()»
961
961
962
- say Any.pairs; # OUTPUT: «()»
963
- my $a;
964
- say $a.pairs; # OUTPUT: «()»
965
- $a = Any.new;
966
- say $a. pairs; # OUTPUT: «(0 => Any.new) »
962
+ For a value object, it converts the invocant to a L < List|/type/List > via the
963
+ C < list > method and returns the result of L < List.pairs|/type/List#routine_pairs >
964
+ on it.
965
+
966
+ <1 2 2 3 3 3>.Bag. pairs.say; # OUTPUT: «(1 => 1 3 => 3 2 => 2) »
967
967
968
+ In this case, every element (with weight) in a bag is converted to a pair.
968
969
969
970
= head2 method antipairs
970
971
You can’t perform that action at this time.
0 commit comments