Documentation for routine values
assembled from the following pages:
Role: Baggy §
From Baggy
(Baggy) method values §
Defined as:
method values(Baggy: --> Seq)
Returns a Seq
of all values, i.e. weights, in the Baggy
object.
my = bag <eggs spam spam spam>;say .values.sort; # OUTPUT: «(1 3)» my = ("a" => 5, "b" => 2, "a" => 1).BagHash;say .values.sort; # OUTPUT: «(2 6)»
Class: Any §
From Any
(Any) method values §
Defined as:
multi method values(Any:)multi method values(Any:)
Will return an empty list for undefined or class arguments, and the object converted to a list otherwise.
say (1..3).values; # OUTPUT: «(1 2 3)» say List.values; # OUTPUT: «()»
Class: List §
From List
(List) routine values §
Defined as:
sub values( --> Seq)method values(List: --> Seq)
Returns a sequence of the list elements, in order.
say (1,2,3,4).^name; # OUTPUT: «List» say (1,2,3,4).values.^name; # OUTPUT: «Seq»
Class: Map §
From Map
(Map) method values §
Defined as:
method values(Map: --> Seq)
Returns a Seq
of all values in the Map.
my = Map.new('a' => (2, 3), 'b' => 17);say .values; # OUTPUT: «((2 3) 17)»
Role: Setty §
From Setty
(Setty) method values §
Defined as:
multi method values(Setty: --> Seq)
Returns a Seq containing as many True
values as the set has elements.
my = Set.new(1, 2, 3);say .values; # OUTPUT: «(True True True)»
Class: Pair §
From Pair
(Pair) method values §
Defined as:
multi method values(Pair: --> List)
Returns a List containing the value of the invocant.
say (Raku => "d").values; # OUTPUT: «(d)»
Class: Capture §
From Capture
(Capture) method values §
Defined as:
multi method values(Capture: --> Seq)
Returns a Seq containing all positional values followed by all named argument values.
my = \(2, 3, 5, apples => (red => 2));say .values; # OUTPUT: «(2 3 5 red => 2)»