Hi Diab-
I don't think there is a corresponding method to
how where can apply to a whole list of pdls.
It does look like it might be possible to have an
extended version of index1d that might support
the where-style ins and outs but I'm not clear how
much of an advantage it would be.
Your map code seems pretty simple already (to me)
and the map {} idiom is *exactly* a strength of PDL
because it *is*perl after all....
--Chris
On Fri, Dec 5, 2014 at 1:58 PM, Diab Jerius <[email protected]> wrote:
> Chris,
>
> The vsearch() bit is just to show that I'm dealing with indices, not a
> mask. I'd like to index into multiple variables in one call, without
> needing to create a temporary to contain the index.
>
> If I were to write it with no error checking, it'd be
>
> sub whindex { my $idx = pop; map { $_->index($idx) } @_ }
>
> It seems like something that might already exist, hence the question.
>
>
> On Thu, Dec 4, 2014 at 5:34 PM, Chris Marshall <[email protected]>
> wrote:
> > Do you have a working example of what you want?
> > What you've described seems to want to index piddles
> > $x and $y by indx values from vsearch-ing $xs which
> > is not related to the shape of $x or $y.
> >
> > --Chris
> >
> >
> > On Thu, Dec 4, 2014 at 3:51 PM, Diab Jerius <[email protected]>
> wrote:
> >>
> >> In today's attempt to write inscrutable one-liners, I'm trying
> >> to turn the following code
> >>
> >> $index = vsearch( $x, $xs );
> >> @piddles = map { $_->index($idx) } $x, $y;
> >>
> >> Into something like this:
> >>
> >> @piddles = whindex( $x, $y, vsearch( $x, $xs ) );
> >>
> >> e.g., where(), but with indices instead of a mask.
> >>
> >> Does such a function exist?
> >>
> >> Thanks!
> >> Diab
> >>
> >> _______________________________________________
> >> Perldl mailing list
> >> [email protected]
> >> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
> >
> >
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl