Skip to content

Commit 72773cb

Browse files
committed
Fixes pairs refs #1731
1 parent 2010560 commit 72773cb

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

doc/Type/Any.pod6

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -951,20 +951,21 @@ If it's a class, it will simply return Nil.
951951
952952
Defined as:
953953
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:)
956956
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:
960959
960+
say Num.pairs; # OUTPUT: «()␤»
961961
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)␤»
967967
968+
In this case, every element (with weight) in a bag is converted to a pair.
968969
969970
=head2 method antipairs
970971

0 commit comments

Comments
 (0)