Re: Deleting duplicates from a list
- To: mathgroup at smc.vnet.net
- Subject: [mg76125] Re: Deleting duplicates from a list
- From: dimitris <dimmechan at yahoo.com>
- Date: Wed, 16 May 2007 05:44:16 -0400 (EDT)
- References: <f292sh$m3p$1@smc.vnet.net><f2bssg$gqc$1@smc.vnet.net>
The reference and the built-in function were for unsorted union. In your case, you can simply use Union. Dimitris =CF/=C7 dimitris =DD=E3=F1=E1=F8=E5: > FrontEndExecute[{HelpBrowserLookup["RefGuide", "Union"]}] > > FrontEndExecute[{HelpBrowserLookup["RefGuide", "Reap"]}] > > > Also > > In[11]:= > unUn[lis_List] := lis //. {a___, b_, c___, d_, e___} :> {a, b, c, > e} /; b == d > > In[14]:= > lst = Table[Random[Integer, {1, 10}], {30}] > Out[14]= > {3, 7, 8, 7, 1, 8, 9, 5, 5, 3, 2, 5, 3, 4, 3, 1, 10, 6, 2, 8, 6, 7, 6, > 4, 1, 1, 7, 9, 9, 3} > > In[15]:= > unUn[lst] > Out[15]= > {3, 7, 8, 1, 9, 5, 2, 4, 10, 6} > > Dimitris > > =CF/=C7 Raul Martinez =DD=E3=F1=E1=F8=E5: > > Hi all, > > > > I have a list, e.g., {8, 8, 11, 11, 19}. I want to eliminate all > > duplicates so the list becomes {8, 11, 19}. Can anyone suggest a > > command that will do this? > > > > TIA, > > > > Raul Martinez