Re: Union - simple question

*To*: mathgroup at smc.vnet.net*Subject*: [mg49012] Re: [mg49009] Union - simple question*From*: Adriano Pascoletti <pascolet at dimi.uniud.it>*Date*: Tue, 29 Jun 2004 04:49:39 -0400 (EDT)*References*: <200406280813.EAA04305@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Steve, it works if you write SameTest instead of Sametest (at least on my machine: Mathematica 5.0.1 and Mac OSX 10.3). A.P. Il giorno 28/giu/04, alle 10:13, Steve Gray ha scritto: > 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. > > ------------------------------------------------------------------------ -------- Adriano Pascoletti Dipartimento di Matematica e Informatica Universita' di Udine Via delle scienze 206 I-33100 Udine Italy

**References**:**Union - simple question***From:*Steve Gray <stevebg@adelphia.net>