Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Created June 20, 2016 19:52
Show Gist options
  • Select an option

  • Save dogbert17/8f9272fe0ac15d82e6cc065372603b9b to your computer and use it in GitHub Desktop.

Select an option

Save dogbert17/8f9272fe0ac15d82e6cc065372603b9b to your computer and use it in GitHub Desktop.
Attempt to document Baggy.antipairs
=head2 method antipairs
Defined as:
method antipairs(Baggy:D:) returns Seq:D
Returns all elements and their respective weights as a L<Seq|/type/Seq> of C<Pair>s
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>.
my $breakfast = bag <eggs bacon>;
my $seq = $breakfast.antipairs;
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