Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dogbert17/1762f03949c76c8bb0d171725acfc73d to your computer and use it in GitHub Desktop.
Save dogbert17/1762f03949c76c8bb0d171725acfc73d to your computer and use it in GitHub Desktop.
Attempt to document Baggy.kxxv
=head2 method kxxv
Defined as:
method kxxv(Baggy:D:) returns List:D
Returns a list of the keys of the invocant, with each key multiplied by its
weight. Note that C<kxxv> only works for C<Baggy> types which have integer
weights, i.e. L<Bag> and L<BagHash>.
my $breakfast = bag <spam eggs spam spam bacon>;
say $breakfast.kxxv.sort; # (bacon eggs spam spam spam)
my $n = ("a" => 0, "b" => 1, "b" => 2).BagHash;
say $n.kxxv; # (b b b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment