Re: Re: how to delete duplicate items in the same list

• To: mathgroup at smc.vnet.net
• Subject: [mg45592] Re: [mg45576] Re: how to delete duplicate items in the same list
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Fri, 16 Jan 2004 06:05:06 -0500 (EST)
• References: <bto1uf\$2ka\$1@smc.vnet.net> <bu0cjl\$ah9\$1@smc.vnet.net> <200401140626.BAA19761@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```On 14 Jan 2004, at 06:26, AES/newspost wrote:

>>> I can't find a way to make sure all items in the same list are
>>> unique. Can
>>> anybody help me out? Thanks a lot!
>
>> Union[a]==a
>
>
> Can anyone explain why "Union" means what it does?  -- or at least a
> mental crutch to help me remember that Union is the command that does
> this?
>
> (Doesn't seem an obvious name for the function involved, though I
> suppose I could try to think "Unique" --->  "Union")
>
>
Union is simply an implementation of the usual Union of set theory,
though in the context of a computer program.

So, for example,

Union[{a,b,c},{a,c,e}]

{a,b,c,e}

exactly as you would expect. This is achieved by joining the combining
th elements of both lists, sorting them and removing duplicates.
The possibility of using Union for testing the presence or absence  of
duplicates is a side effect rather than the main purpose of Union.
Besides the test should involve Length, in other words not Union[a]==a
but Length[Union[a]]==Length[a].

Andrzej Kozlowski
Chiba, Japan
http://www.mimuw.edu.pl/~akoz/

```

• Prev by Date: Who find a better fit of this experimental data?
• Next by Date: Re: typesetting fractions
• Previous by thread: Re: Re: how to delete duplicate items in the same list
• Next by thread: Re: Re: Re: how to delete duplicate items in the same list