Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Last active June 20, 2016 19:11
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/efcb4849920629c281f0b8942b42fbf3 to your computer and use it in GitHub Desktop.
Save dogbert17/efcb4849920629c281f0b8942b42fbf3 to your computer and use it in GitHub Desktop.
Attempt to document Baggy.pairs
=head2 method pairs
Defined as:
method pairs(Baggy:D:) returns Seq:D
Returns all elements and their respective weights as a L<Seq|/type/Seq> of C<Pair>s
where the key is the element itself and the value is the weight of that element.
my $breakfast = bag <bacon eggs bacon>;
my $seq = $breakfast.pairs;
say $seq.sort; # (bacon => 2 eggs => 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment