File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -1006,18 +1006,22 @@ converting the object to a list is not a list of pairs, the method will fail.
1006
1006
1007
1007
Defined as:
1008
1008
1009
- multi method kv(Any:U: -->List)
1010
- multi method kv(Any:D: -->List)
1009
+ multi method kv(Any:U:)
1010
+ multi method kv(Any:D:)
1011
+ multi sub kv($x)
1011
1012
1012
- Invokes C < list > on the invocant and returns the result of
1013
- L < List.kv|/type/List#routine_kv > on it.
1014
- Returns an empty L < List|/type/List > if the invocant is undefined:
1015
1013
1016
- my $a;
1017
- say $a.kv; # OUTPUT: «()»
1018
- $a = Any.new;
1019
- say $a.kv; # OUTPUT: «(0 Any.new)»
1020
- say Any.kv; # OUTPUT: «()»
1014
+ Returns an empty L < List|/type/List > if the invocant is a type object:
1015
+
1016
+ Sub.kv.say ;# OUTPUT: «()»
1017
+
1018
+ It calls C < list > on the invocant for value objects and returns the result of
1019
+ L < List.kv|/type/List#routine_kv > on it as a list where keys and values will be
1020
+ ordered and contiguous
1021
+
1022
+ <1 2 3>.kv.say; # OUTPUT: «(0 1 1 2 2 3)»
1023
+
1024
+ In the case of C < Positional > s, the indices will be considered I < keys > .
1021
1025
1022
1026
= head2 method toggle
1023
1027
You can’t perform that action at this time.
0 commit comments