MathGroup Archive 2005

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

Search the Archive

Re: subtle dumb question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55597] Re: [mg55574] subtle dumb question
  • From: "Jaccard Florian" <Florian.Jaccard at he-arc.ch>
  • Date: Wed, 30 Mar 2005 05:29:04 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

For example :

In[73]:=
blah = {{beta, {a, b, c}}, {zeta, {x, y, z}}}; 

In[74]:=
blah2 = {{1, {2, 3, 4}}, {5, {6, 7, 8}}, {9, {10, 11, 12}}}; 

In[75]:=
Map[{#1[[1]], #1[[2,2]]} & , blah, {1}]

Out[75]=
{{beta, b}, {zeta, y}}

In[76]:=
Map[{#1[[1]], #1[[2,2]]} & , {blah, blah2}, {2}]

Out[76]=
{{{beta, b}, {zeta, y}}, {{1, 3}, {5, 7}, {9, 11}}}

In[77]:=
Flatten[Map[{#1[[1]], #1[[2,2]]} & , {blah, blah2}, {2}], 1]

Out[77]=
{{beta, b}, {zeta, y}, {1, 3}, {5, 7}, {9, 11}}

Meilleures salutations
 
F.Jaccard


-----Message d'origine-----
De : Chris Chiasson [mailto:chris.chiasson at gmail.com] 
Envoyé : mercredi, 30. mars 2005 10:21
À : mathgroup at smc.vnet.net
Objet : [mg55574] subtle dumb question

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
1 810 265 3161


  • Prev by Date: Re: Much faster ConvexHull implementation
  • Next by Date: Re: Need a functional process for this.
  • Previous by thread: Re: subtle dumb question
  • Next by thread: Re: subtle dumb question