Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: rule based program for "Deleting repeated members of a list."

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81946] Re: rule based program for "Deleting repeated members of a list."
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Sun, 7 Oct 2007 05:34:56 -0400 (EDT)

On 10/6/07 at 4:47 AM, csarami at gmail.com (mumat) wrote:

>I have a list s={a,b,c,c,d,e,e,f,g,g,g,h,a,b};

>I need to write a program so that it reads the list and ignors
>repeated elements; so it outputs the following:

>RepeatRemover[s]={a,b,c,d,e,f,g,h,a,b};

In[3]:= {a, b, c, c, d, e, e, f, g, g, g, h, a,
   b} //. {z__, x_, x_, y__} -> {z, x, y}

Out[3]= {a,b,c,d,e,f,g,h,a,b}
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: rule based program for "Deleting repeated members of a list."
  • Next by Date: Re: Riffle[] accepts only lists. Why?
  • Previous by thread: Re: rule based program for "Deleting repeated members of a list."
  • Next by thread: Re: rule based program for "Deleting repeated members of a list."