Documentation for routine total

Documentation for routine total, assembled from the following types:

role Baggy

From Baggy

(Baggy) method total

Defined as:

method total(Baggy:D:)

Returns the sum of weights for all elements in the Baggy object.

my $breakfast = bag <eggs spam spam bacon>;
say $breakfast.total;                             # OUTPUT: «4␤» 
 
my $n = ("a" => 5"b" => 1"b" => 2).BagHash;
say $n.total;                                     # OUTPUT: «8␤» 

role Mixy

From Mixy

(Mixy) method total

method total(--> Real)

Returns the sum of all the weights

mix('a''b''c''a''a''d').total == 6# RESULT: «True» 
{=> 5.6=> 2.4}.Mix.total == 8;          # RESULT: «True» 

role Setty

From Setty

(Setty) method total

method total(--> Int)

The total of all the values of the QuantHash object. For a Setty object, this is just the number of elements.