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