In Any§
See primary documentation in context for method pairup.
multi method pairup(Any:U:) multi method pairup(Any:D:)
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 Pair
s 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.raku; # OUTPUT: «(:a(1), :b("c")).Seq»