Re: Select from a list
- To: mathgroup at smc.vnet.net
- Subject: [mg49900] Re: Select from a list
- From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
- Date: Thu, 5 Aug 2004 09:22:11 -0400 (EDT)
- References: <ceqtvt$k0n$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
This does what you want:
a={1,1,2,2,4,6,6,8,8,9};
b=Split[a]
{{1,1},{2,2},{4},{6,6},{8,8},{9}}
Map[First,b]
{1,2,4,6,8,9}
Steve Luttrell
"Feng-Yin Chang" <fychang at slac.stanford.edu> wrote in message
news:ceqtvt$k0n$1 at smc.vnet.net...
> Hi everyone,
>
> Does anyone have an idea to drop the repeating elements in one list?
> The list was built in sequence,fortunately.
>
> for example,
> from a={1,1,2,2,4,6,6,8,8,9}
> to a1={1,2,4,6,8,9}
>
>
> The purpose is to avoid the one-to-many mapping problem in my case.
>
> Feng-Yin Chang,
> Institute of Physics,NCTU,Taiwan
>