Skip to content

Commit 74757ad

Browse files
author
Jan-Olof Hendig
committed
Added docs for method 'pairs' in Baggy. moritz++
1 parent ffb9ce7 commit 74757ad

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

doc/Type/Baggy.pod

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,20 @@ chosen elements from the invocant.
140140
my $random_dishes := $breakfast.roll(*);
141141
say $random_dishes[^5]; # (bacon eggs bacon bacon bacon)
142142
143+
=head2 method pairs
144+
145+
Defined as:
146+
147+
method pairs(Baggy:D:) returns Seq:D
148+
149+
Returns all elements and their respective weights as a L<Seq|/type/Seq> of C<Pair>s
150+
where the key is the element itself and the value is the weight of that element.
151+
152+
my $breakfast = bag <bacon eggs bacon>;
153+
my $seq = $breakfast.pairs;
154+
say $seq.sort; # (bacon => 2 eggs => 1)
155+
156+
143157
=head2 method classify-list
144158
145159
=comment TODO

0 commit comments

Comments
 (0)