Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Created June 24, 2016 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogbert17/56d39157e503843a0708f646f9261355 to your computer and use it in GitHub Desktop.
Save dogbert17/56d39157e503843a0708f646f9261355 to your computer and use it in GitHub Desktop.
Attempt to document Map.antipairs
=head2 method antipairs
Defined as:
method antipairs(Map:D:) returns Seq:D
Returns all keys and their respective values as a L<Seq|/type/Seq> of C<Pair>s
where the keys and values have been exchanged, i.e. the opposite of method
L<pairs|#method_pairs>. Unlike the L<invert|#method_invert> method, there is
no attempt to expand list values into multiple pairs.
my $m = Map.new('a' => (2, 3), 'b' => 17);
say $m.antipairs; # ((2 3) => a 17 => b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment