method pairup
1 | class Any |
1.1 | (Any) method pairup |
Documentation for method pairup
assembled from the following types:
class Any
From Any
(Any) method pairup
Defined as:
multi method pairup(Any:)multi method pairup(Any:)
Returns an empty Seq if the invocant is a type object
Range.pairup.say; # OUTPUT: «()»
Interprets the invocant as a list, and constructs a list of pairs from it, in the same way that assignment to a Hash does. That is, it takes two consecutive elements and constructs a pair from them, unless the item in the key position already is a pair (in which case the pair is passed through, and the next list item, if any, is considered to be a key again). It returns a Seq
of Pair
s.
say (a => 1, 'b', 'c').pairup.perl; # OUTPUT: «(:a(1), :b("c")).Seq»