mesh_shortest#

Interleave multiple arrays, stopping at the shortest.

תקציר#

my @out = mesh_shortest \@a, \@b, \@c;

מה מוחזר#

A flat list containing elements at position 0 from each input, then 1, and so on - up to the length of the shortest input. No undef padding.

דוגמאות#

my @r = mesh_shortest [1..3], ['a','b'];   # (1,'a', 2,'b')
my @r = mesh_shortest [1..3], [];          # ()

הבדלים מן ה-upstream#

Fully compatible with upstream.

ראו גם#

  • mesh / mesh_longest - pad to longest instead.

  • zip_shortest - same lockstep walk, but yields one arrayref per row.