MathGroup Archive 2006

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

Search the Archive

Re: Filtering same elements from two lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67947] Re: Filtering same elements from two lists
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 18 Jul 2006 05:50:31 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <e9frcp$2kg$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

list1 = {{PLUS1, 55, 43}, {PLUS2, 555, 83}, 
{PLUS3, 4, 12}} ;
list2 = {{PLUS3, 55, 43}, {PLUS1, 555, 83}, 
{PLUS2, 4, 12}} ;


and

Prepend[Join @@ (Rest /@ # ), #[[1, 1]]] & /@
Split[Sort[Join[list1, list2]], First[#1] === 
First[#2] &]

???

Regards

  Jens

"LectorZ" <lectorz at mail.ru> schrieb im Newsbeitrag 
news:e9frcp$2kg$1 at smc.vnet.net...
| Dear experts,
|
| I do have to not ordered lists of the following 
type (same shape and
| length):
|
| list1={{PLUS1, 55, 43}, {PLUS2, 555, 83}, 
{....},...}
|
| list2={{..., ...,...}, {..., ...,...},{..., 
...,...},{...,
| ...,...},{PLUS1,77, 99}, {..., ...,...},{PLUS2, 
52,103}, {....}}
|
| I have to filter the same records according to 
the 1st element of each
| sublist and make a new list with the joint 
numbers from both lists.
|
| The result in this case should be:
|
| resultlist={{PLUS1, 55, 43, 77, 99}, {PLUS2, 
555, 83, 52,103}, {....}}
|
| Thanks,
|
| LZ
| 



  • Prev by Date: Re: Filtering same elements from two lists
  • Next by Date: Re: Why Does Repeated Dot Product Take So Long?
  • Previous by thread: Re: Filtering same elements from two lists
  • Next by thread: Re: Filtering same elements from two lists