Documentation for infix Z

Documentation for infix Z, assembled from the following types:

language documentation Operators

From Operators

(Operators) infix Z

sub infix:<Z>(**@lists --> Seq:Dis assoc<chain>

Zip operator.

Interleaves the lists passed to Z like a zipper, stopping as soon as the first input list is exhausted. The returned Seq contains a nested list with values for all Z operators in a chain.

say (12 Z <a b c> Z <+ ->).perl;  # OUTPUT: «((1, "a", "+"), (2, "b", "-")).Seq␤» 
for <a b c> Z <1 2 3> -> [$l$r{
    say "$l:$r"
}
# OUTPUT: «a:1␤b:2␤c:3␤» 

The Z operator also exists as a meta operator, in which case the inner lists are replaced by the value from applying the operator to the list:

say 100200 Z+ 4223;             # OUTPUT: «(142 223)␤» 
say 1..3 Z~ <a b c> Z~ 'x' xx 3;    # OUTPUT: «(1ax 2bx 3cx)␤»