Re: subtle dumb question
- To: mathgroup at smc.vnet.net
- Subject: [mg55603] Re: [mg55574] subtle dumb question
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Thu, 31 Mar 2005 01:23:54 -0500 (EST)
- References: <200503300821.DAA21827@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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
- References:
- subtle dumb question
- From: Chris Chiasson <chris.chiasson@gmail.com>
- subtle dumb question