in reply to Re: parallel procesing
in thread parallel procesing
Personally I prefer to use a non-iterator style, so I combine (my own) zip with pair from List::Pairwise.
The main reason I like pair over natatime is that it's easy to combine with any expression/subroutine that requires the whole list and in particular sort (but also map and grep). For instance:for (pair(zip($array1, $array2))) { my ($x, $y) = @$_; # It's often descriptive to name the values. ... }
The reason I don't use zip from List::MoreUtils is that it's prototyped with (\@\@;\@...) which I find counter-intuitive, as I imagine you do too as you passed in $array1 instead of @$array1. It's also more in the way than it's helping, as I frequently end up with wanting to zip the result of an expression instead of an array or having a list or an array holding array references.for ( sort { $a->[0] <=> $b->[0] or $a->[1] cmp $b->[1] } pair zip($array1, $array2) ) { my ($number, $char) = @$_; ... }
lodin
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: parallel procesing (List::Pairwise)
by baxy77bax (Deacon) on Apr 06, 2008 at 14:12 UTC | |
by GrandFather (Saint) on Apr 06, 2008 at 21:01 UTC | |
by ikegami (Patriarch) on Apr 07, 2008 at 03:13 UTC |