Mathematica 9 is now available
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: [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


  • 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