Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change use of .elems on Set/Bag/Mix to new method .total
  • Loading branch information
lizmat committed Oct 3, 2013
1 parent 1d47100 commit 29e1f75
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions S32-setting-library/Containers.pod
Expand Up @@ -1215,7 +1215,7 @@ A mutable Set container, represented as C<QuantHash[Bool,False]>.
A collection of values or objects that work just like sets, except
that they need not be unique. The count of each value or object is
represented by an associative mapping from each key value/object to its
replication number. The C<.elems> method returns the sum of all
replication number. The C<.total> method returns the sum of all
replication values.

Sets and bags do not flatten into list context, nor do the constructors
Expand Down Expand Up @@ -1281,7 +1281,7 @@ in the case of bag types). C<SetHash> and C<MixBag> are derived
from this type, but constrain their hash values to be C<Bool> and
C<UInt>, respectively. A C<QuantHash> automatically deletes any key
whose corresponding value goes to the default value for the hash.
For any C<QuantHash>, the C<.elems> methods returns the current sum
For any C<QuantHash>, the C<.total> methods returns the current sum
of the values, which the C<QuantHash> must either track or compute
on demand. Tracking is preferable for efficient implementation of
C<.pick> and C<.grab>.
Expand Down Expand Up @@ -1309,7 +1309,7 @@ only from the temporary copy.)

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
By definition, C<.total> of the bag also decreases by one, so the
probabilities stay consistent through subsequent grab operations.

With the C<.grabpairs> version, the replication value of the picked
Expand Down

0 comments on commit 29e1f75

Please sign in to comment.