Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

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


  • Prev by Date: Re: exploded plots
  • Next by Date: Re: intersection point from listplots
  • Previous by thread: Re: subtle dumb question
  • Next by thread: Need a functional process for this.