Created
July 3, 2016 10:15
-
-
Save dogbert17/818b4229a000c9e19c25b3c782951b44 to your computer and use it in GitHub Desktop.
Attempt to document Baggy.invert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 method invert | |
Defined as: | |
method invert(Baggy:D:) returns Seq:D | |
Returns all elements and their respective weights as a L<Seq|/type/Seq> of L<Pairs|/type/Pair>, | |
where the element itself is the value and the weight of that element is the key, i.e. | |
the opposite of method L<pairs|#method pairs>. Except for some esoteric cases C<invert> on a | |
Baggy type returns the same result as L<antipairs|#method_antipairs>. | |
my $breakfast = bag <bacon eggs bacon>; | |
my $seq = $breakfast.invert; | |
say $seq.sort; # (1 => eggs 2 => bacon) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment