in reply to statistics basic - filter vector according to array
->set_filter( sub { map $_[$_], grep $filter[$_], 0..$#_ } )
or
->set_filter( sub { map { $_[$_] ? $filter[$_] : () } 0..$#_ } )
or
->set_filter( sub { @_[ grep $filter[$_], 0..$#_ ] } )
Update: Fixed typo in first solution.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: statistics basic - filter vector according to array
by flies (Novice) on Mar 09, 2011 at 20:59 UTC |