Re: List of multiple elements

• To: mathgroup at smc.vnet.net
• Subject: [mg112095] Re: List of multiple elements
• From: Bill Rowe <readnews at sbcglobal.net>
• Date: Mon, 30 Aug 2010 06:19:48 -0400 (EDT)

```On 8/29/10 at 2:49 AM, weh at snafu.de (Dr. Wolfgang Hintze) wrote:

>Bill, you are right, I made a mistake forgetting the Sort

>m1[x_]:= Flatten[Take[#, {1, Length[#] - 1}] & /@
>Select[Split[Sort[x]], Length[#] > 1 &]]

>Derivation by example

>x={1, 1, 2, 3, 1, 3}
>Sort[x]
>{1, 1, 1, 2, 3, 3}
>Split[%]
>{{1, 1, 1}, {2}, {3, 3}}
>Select[%, Length[#] > 1 &]
>{{1, 1, 1}, {3, 3}}
>Take[#, {1, Length[#] - 1}] & /@ %
>Out[77]=
>{{1, 1}, {3}}
>In[78]:=
>Flatten[%]
>Out[78]=
>{1, 1, 3}

The derivation makes it clear what you want to do. Here is some
code that does the same and seems to me to be simpler

In[6]:= Flatten[Most /@ DeleteCases[Split@Sort[x], {_}]]

Out[6]= {1,1,3}

```

• Prev by Date: Re: FindRoots?
• Next by Date: Re: FindRoots?
• Previous by thread: Re: List of multiple elements
• Next by thread: Re: List of multiple elements