Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: complicated list selector

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98477] Re: [mg98415] complicated list selector
  • From: Adriano Pascoletti <adriano.pascoletti at dimi.uniud.it>
  • Date: Fri, 10 Apr 2009 04:57:32 -0400 (EDT)
  • References: <200904090955.FAA06526@smc.vnet.net>

In[2]:= data /. {x_, {y_, _}} :> {x, y}
Out[2]= {{11, 121}, {21, 221}, {31, 321}}


In[3]:= ({#1[[1]], #1[[2, 2]]} & ) /@ data
Out[3]= {{11, 122}, {21, 222}, {31, 322}}


Adriano Pascoletti

2009/4/9 summer <summertan at hotmail.com>

> I have the following list
>
> data = {  {11, {121, 122}},   {21, {221, 222}},  {31, {321, 322}} };
>
> >From each sublist, I want to extract the first element and the second
> element of the second sub-sub-list that is:
>
> wanted_result={  {11, 122},   {21, 222},   {31, 322}   }
>
> I tried
>
> data[[All, {1, {2,1}}]]
>
> but it gives me error.
>
> What is the right selector ?
>
>


  • Prev by Date: Re: complicated list selector
  • Next by Date: Re: complicated list selector
  • Previous by thread: complicated list selector
  • Next by thread: Re: complicated list selector