MathGroup Archive 2009

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

Search the Archive

Re: Manipulating list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101494] Re: [mg101486] Manipulating list
  • From: Adriano Pascoletti <adriano.pascoletti at dimi.uniud.it>
  • Date: Thu, 9 Jul 2009 01:51:54 -0400 (EDT)
  • References: <200907081113.HAA12448@smc.vnet.net>

In[6]:= Transpose[{list1, list2}] /. {{__, x_}, {y__}} :> {x, y}
Out[6]= {{C, 1, 2}, {F, 3, 4}, {I, 5, 6}}


In[7]:= MapThread[{Last[#1], Sequence @@ #2} & , {list1, list2}]
Out[7]= {{C, 1, 2}, {F, 3, 4}, {I, 5, 6}}


Adriano Pascoletti

2009/7/8 kosal lee <leekosal at yahoo.com>

> Hello Mathematica users
>
> I am new to Mathematica and I have one particular problem I would like you
> to help me.
> Suppose I have two lists:
>
>    list1 = {{A,B,C},{D,E,F},{G,H,I}}
>    list2 = {{1,2},{3,4},{5,6}}
>
> I want to have the third elements in each of member list in list1 (that is,
> C,F,I) to appear in the first position in each member list in list2
>
> that is, i want to have  list ={{C,1,2},{F,3,4},{I,5,6}}
>
>  Thank you.
> Kosal
>
>



  • Prev by Date: Re: Selecting Rows Based on Column Values
  • Next by Date: Re: Selecting Rows Based on Column Values
  • Previous by thread: Re: Manipulating list
  • Next by thread: Re: Manipulating list