pairup
ErrorsCollection

pairup

Synthesised documentation from type/Any

From type/Any

See Original text in context

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 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 Pairs.

say (=> 1'b''c').pairup.raku;     # OUTPUT: «(:a(1), :b("c")).Seq␤»