Re: Re: Deleting duplicates from a list

• To: mathgroup at smc.vnet.net
• Subject: [mg76049] Re: [mg76000] Re: [mg75940] Deleting duplicates from a list
• From: Murray Eisenberg <murray at math.umass.edu>
• Date: Tue, 15 May 2007 04:58:43 -0400 (EDT)
• Organization: Mathematics & Statistics, Univ. of Mass./Amherst
• References: <200705140725.DAA22641@smc.vnet.net> <200705140948.FAA26049@smc.vnet.net>

```What's wrong with just Union here?

Union[{8,8,11,11,19}]
{8,11,19}

> 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}
>
>
> 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
>>
>
>

--
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

```

• Prev by Date: Re: Compatibility woes
• Next by Date: Re: Converting Binary form to a desired array
• Previous by thread: Re: Deleting duplicates from a list
• Next by thread: Re: Deleting duplicates from a list