Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Replaces and moves invert, refs #1731
  • Loading branch information
JJ committed Feb 19, 2019
1 parent 218b7f1 commit 7f98d42
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions doc/Type/Any.pod6
Expand Up @@ -973,15 +973,32 @@ Defined as:
multi method antipairs(Any:U:)
multi method antipairs(Any:D:)
Converts the invocant to a L<List|/type/List> via the C<list> method and returns the result of
L<List.antipairs|/type/List#routine_antipairs> on it.
Returns an empty L<List|/type/List> if the invocant is undefined:
Converts the invocant to a L<List|/type/List> via the C<list> method and returns
the result of L<List.antipairs|/type/List#routine_antipairs> on it. Returns an
empty L<List|/type/List> if the invocant is undefined:
my $a;
say $a.antipairs; # OUTPUT: «()»
$a = Any.new;
say $a.antipairs; # OUTPUT: «(Any.new => 0)»
=head2 method invert
Defined as:
multi method invert(Any:U:)
multi method invert(Any:D:)
Applied to a type object will return an empty list; applied to an object will
convert it to a list and apply L<C<List.invert>|/type/List#routine_invert> to
it, that is, interchange key with value in every Pair. The resulting list needs
to be a list of C<Pair>s.
"aaabbcccc".comb.Bag.invert.say; # OUTPUT: «(4 => c 3 => a 2 => b)␤»
In this case, a C<Bag> can be converted to a list of C<Pair>s. If the result of
converting the object to a list is not a list of pairs, the method will fail.
=head2 method kv
Expand Down Expand Up @@ -1131,16 +1148,6 @@ details.
say Any.nl-out; # OUTPUT: «␤␤»
=head2 method invert
Defined as:
method invert(--> List)
Returns an empty List.
say Any.invert; # OUTPUT: «()␤»
=head2 method combinations
Defined as:
Expand Down

0 comments on commit 7f98d42

Please sign in to comment.