Skip to content

Commit 155abd8

Browse files
committed
(Bag|BagHash).pickpairs are more like .grabpairs
1 parent d0e9368 commit 155abd8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

S32-setting-library/Containers.pod

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,10 +1238,9 @@ rather than a constructor.)
12381238

12391239
Like an ordinary list C<pick>, but returns keys of the bag weighted by
12401240
values, as if the keys were replicated the number of times indicated
1241-
by the corresponding value and then list pick used. The C<pickpairs> method
1242-
does the same, except it returns both key and value. C<BagHash> is the
1243-
mutable form of C<Bag>. A C<Bag> responds to hash operators as
1244-
if it were a C<Hash of UInt>.
1241+
by the corresponding value and then list pick used. C<BagHash> is the
1242+
mutable form of C<Bag>. A C<Bag> responds to hash operators as if it were
1243+
a C<Hash of UInt>.
12451244

12461245
The underlying metaphor for picking is that you're pulling colored
12471246
marbles out a bag. (For "picking with replacement" see C<roll> instead.)
@@ -1252,6 +1251,9 @@ using the corresponding C<.grab> or C<.grabpairs> method (see below).
12521251
Each C<.pick>/C<.pickpairs> invocation maintains its own private state and
12531252
has no effect on subsequent C<.pick>/C<.pickpairs> invocations.
12541253

1254+
The C<.pickpairs> version returns the grabbed values as a list of C<Pair>
1255+
objects, whose keys are the keys and whose values are the replication values.
1256+
12551257
=item roll
12561258

12571259
multi method roll ( $bag: Int $num = 1 --> Any )

0 commit comments

Comments
 (0)