Skip to content

Commit fdcab8f

Browse files
committed
Fixes antipairs refs #1731
1 parent 72773cb commit fdcab8f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

doc/Type/Any.pod6

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -974,14 +974,15 @@ Defined as:
974974
multi method antipairs(Any:U:)
975975
multi method antipairs(Any:D:)
976976
977-
Converts the invocant to a L<List|/type/List> via the C<list> method and returns
978-
the result of L<List.antipairs|/type/List#routine_antipairs> on it. Returns an
979-
empty L<List|/type/List> if the invocant is undefined:
977+
Returns an
978+
empty L<List|/type/List> if the invocant is a type object
980979
981-
my $a;
982-
say $a.antipairs; # OUTPUT: «()»
983-
$a = Any.new;
984-
say $a.antipairs; # OUTPUT: «(Any.new => 0)»
980+
Range.antipairs.say; # OUTPUT: «()␤»
981+
982+
If it's a value object, it returns the inverted list of pairs after converting
983+
it to a list of pairs; the values will become keys and the other way round.
984+
985+
%(s => 1, t=> 2, u => 3).antipairs.say ;# OUTPUT: «(2 => t 1 => s 3 => u)␤»
985986
986987
=head2 method invert
987988

0 commit comments

Comments
 (0)