note
chipmunk
Very nice. There is one addition that I would suggest; allowing for parallel undefs in the arrays. Otherwise the iterator will reset if all the arrays happen to contain undef at the same index, even if there are more elements later in the arrays. Here's one possible solution:
<code>sub parallel_it {
my @arr_refs = @_;
my $iter = 0;
return sub {
if (not grep $iter < @$_, @arr_refs) {
$iter = 0;
return;
}
my @return = map { $_->[$iter] } @arr_refs;
$iter++;
return @return;
};
}
</code>
50165
50165