Skip to content

Commit

Permalink
[S32::Containers] Dropped the :replace argument to .grab and .grabpairs.
Browse files Browse the repository at this point in the history
$bag.grab(5, :replace) is better written as $bag.pick(5, :replace).
  • Loading branch information
Kodi Arfer authored and Kodi Arfer committed Sep 13, 2010
1 parent a877659 commit 4517a6b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions S32-setting-library/Containers.pod
Expand Up @@ -1033,10 +1033,10 @@ to false.

=item grab

our multi method grab ( $bag: Int $num = 1, Bool :$replace )
our multi method grab ( $bag: Whatever, Bool :$replace )
our multi method grabpairs ( $bag: Int $num = 1, Bool :$replace )
our multi method grabpairs ( $bag: Whatever, Bool :$replace )
our multi method grab ( $bag: Int $num = 1 )
our multi method grab ( $bag: Whatever )
our multi method grabpairs ( $bag: Int $num = 1 )
our multi method grabpairs ( $bag: Whatever )

Like C<pick>, a C<grab> returns a random selection of elements, weighted
by the values corresponding to each key.
Expand All @@ -1045,7 +1045,7 @@ works directly on the C<KeyHash>, modifying it in place. (You may use
C<.pick> to treat the C<KeyHash> as immutable; this will copy it and grab
only from the temporary copy.)

Swiping without replacement (the default) decrements the grabbed
Grabbing decrements the grabbed
key's replication value by one (deleting the key when it goes to 0).
By definition, C<.elems> of the bag also decreases by one, so the
probabilities stay consistent through subsequent grab operations.
Expand Down

0 comments on commit 4517a6b

Please sign in to comment.