in reply to interleave (single shuffle)
orsub zip { my $half = @_>>1; return @_[map { ($_&1 && $half) + ($_>>1) } 0 .. $#_]; }
sub zip { my $half = @_>>1; return @_[map { $_, $_+$half } 0 .. $half-1]; }
p.s. A common name for this kind of functionality is "zip". See Language::Functional for an implementation. SO I changed the name for the function to reflect this.
|
|---|