Skip to content

Commit 2d918cf

Browse files
committed
Fixes keys refs #1731
1 parent fdcab8f commit 2d918cf

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

doc/Type/Any.pod6

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,18 +1006,22 @@ converting the object to a list is not a list of pairs, the method will fail.
10061006
10071007
Defined as:
10081008
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)
10111012
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:
10151013
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>.
10211025
10221026
=head2 method toggle
10231027

0 commit comments

Comments
 (0)