MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: subtle dumb question


On 30 Mar 2005, at 10:21, Chris Chiasson wrote:

> Dear MathGroup,
>
> What is the fastest/neatest/most efficient way to do the following?:
>
> blah={{beta,{a,b,c}},{zeta,{x,y,z}}}
>
> <<magic here>>
>
> {{beta,b},{zeta,y}}
>
> What if a have a list of blahs and I want a list of those magic
> results for each blah?
>
> Is there a way to use part (or take or extract) on blah or the list of 
> blahs?
>
> Thank you for your valuables,
> (heh)
> -- 
> Chris Chiasson
> Kettering University
> Mechanical Engineering
> Graduate Student
>


Part 1:

Map[Thread,blah][[All,2]]

{{beta,b},{zeta,y}}

Part 2:
The usual way to deal with this sort of thing: just use map. Namely, use


Map[Thread,#][[All,2]]&/@ls

where ls is your list of blahs.

Andrzej Kozlowski


  • Prev by Date: Re: intersection point from listplots
  • Next by Date: Re: exploded plots
  • Previous by thread: subtle dumb question
  • Next by thread: Re: subtle dumb question