Re: subtle dumb question
- To: mathgroup at smc.vnet.net
- Subject: [mg55631] Re: subtle dumb question
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Thu, 31 Mar 2005 01:25:34 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 3/30/05 at 3:21 AM, chris.chiasson at gmail.com (Chris Chiasson)
wrote:
>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}}
One way to do this would be as follows
In[2]:={#1[[1]], #1[[2,2]]}&/@ blah
Out[2]={{beta, b}, {zeta, y}}
>What if a have a list of blahs and I want a list of those magic
>results for each blah?
In[8]:=Map[{#1[[1]], #1[[2,2]]}&, {blah, blah}, {2}]
Out[8]={{{beta, b}, {zeta, y}}, {{beta, b}, {zeta, y}}}
>Is there a way to use part (or take or extract) on blah or the list
>of blahs?
Clearly yes since #[[1]]& is simply another way of saying Part[#, 1]&
--
To reply via email subtract one hundred and four