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: [mg81942] Re: rule based program for "Deleting repeated members of a list."
  • From: mumat <csarami at gmail.com>
  • Date: Sun, 7 Oct 2007 05:32:49 -0400 (EDT)
  • References: <fe7j44$qga$1@smc.vnet.net>

On Oct 6, 5:05 am, mumat <csar... at gmail.com> wrote:
> Hi,
>
> 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};
>
> I am looking for a rule-based program to do this!
>
> Any help would be greatly appreciated.
>
> C.S.

Thanks so much.

Unrepeat[lis_List]:=lis//.{a___,b_,d_,e___}:>{a,b,e}/;b==d;




  • Prev by Date: Play rests using Mathematica MIDI
  • Next by Date: Re: Help with solving ODE
  • 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."