Re: Manipulating list

• To: mathgroup at smc.vnet.net
• Subject: [mg101526] Re: [mg101486] Manipulating list
• From: DrMajorBob <btreat1 at austin.rr.com>
• Date: Thu, 9 Jul 2009 01:57:50 -0400 (EDT)
• References: <200907081113.HAA12448@smc.vnet.net>
• Reply-to: drmajorbob at bigfoot.com

```list1 = {{A, B, C}, {D, E, F}, {G, H, I}};
list2 = {{1, 2}, {3, 4}, {5, 6}};

MapThread[Prepend[#2, Last@#1] &, {list1, list2}]

{{C, 1, 2}, {F, 3, 4}, {I, 5, 6}}

or

Prepend @@@ Transpose@{list2, list1[[All, -1]]}

{{C, 1, 2}, {F, 3, 4}, {I, 5, 6}}

Bobby

On Wed, 08 Jul 2009 06:13:05 -0500, kosal lee <leekosal at yahoo.com> wrote:

> 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
>

--
DrMajorBob at bigfoot.com

```

• Prev by Date: Re: Selecting Rows Based on Column Values
• Next by Date: Re: RecurrenceTable can't finish
• Previous by thread: Re: Manipulating list
• Next by thread: Re: Manipulating list