Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Deleting duplicates from a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76056] Re: Deleting duplicates from a list
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Tue, 15 May 2007 05:02:22 -0400 (EDT)
  • Organization: University of Bergen
  • References: <200705140725.DAA22641@smc.vnet.net> <f29bb9$pes$1@smc.vnet.net>

Or alternatively, if you don't mind that the list will be sorted, just 
use Union[]. :-)

Adriano Pascoletti wrote:
> This is the unsorted union problem, which can be efficiently solved  
> using Sow and Reap (see Help Browser > Reap > Further Examples)
> 
> In[8]:=UnsortedUnion[x_] := Reap[Sow[1, x], _, #1 & ][[2]]
> 
> In[9]:=UnsortedUnion[{8, 8, 11, 11, 19}]
> 
> Out[9]={8, 11, 19}
> 
> Adriano Pascoletti
> 
> On 14 mag 2007, at 09:25, Raul Martinez wrote:
> 
>> 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
>>


  • Prev by Date: Re: v. 6, third argument to rectangle
  • Next by Date: Re: v. 6, third argument to rectangle
  • Previous by thread: Re: Deleting duplicates from a list
  • Next by thread: Re: Deleting duplicates from a list