Re: Union - simple question
- To: mathgroup at smc.vnet.net
- Subject: [mg49015] Re: [mg49009] Union - simple question
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 29 Jun 2004 04:49:41 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
Use correct spelling of SameTest and it should work. Bob Hanlon > > From: Steve Gray <stevebg at adelphia.net> To: mathgroup at smc.vnet.net > Date: 2004/06/28 Mon AM 04:13:56 EDT > To: mathgroup at smc.vnet.net > Subject: [mg49015] [mg49009] Union - simple question > > I don't understand why Union here doesn't work. (Sort is ok.) > I want Union to eliminate list items where element [[1,2]] is > duplicated. In this case, the first and third are duplicated because > they both have '5' there. > > ts = {{{1,2,3},5}, {{3,8,7},6}, {{7,8,9},5}, {{1,2,3},7}}; > Sort [ts, #1[[2]] < #2[[2]] &] > Union[ts, Sametest -> (#1[[2]] == #2[[2]]&)] > > Any help will be appreciated. > >