MathGroup Archive 2005

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

Search the Archive

Re: the faster way to find repeated sublists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60949] Re: [mg60923] the faster way to find repeated sublists
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Wed, 5 Oct 2005 02:27:50 -0400 (EDT)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

f[x_List,y_List]:=Module[
      {lsl=Length[y]},
      Count[Partition[x,lsl,1],y]*lsl==Length[x]];

f[{1,2,1,2,1,2},{1,2}]

True

f[{1,2,3,1,2,3},{1,2,3}]

True

f[{1,2,1,2,3},{1,2}]

False


Bob Hanlon

> 
> From: "giampiero" <giampiero196019 at yahoo.it>
To: mathgroup at smc.vnet.net
> Date: 2005/10/04 Tue AM 01:24:52 EDT
> Subject: [mg60949] [mg60923] the faster way to find repeated sublists
> 
> i'm newbie
> with a stupid problem
> 
> a function for find repetead sublist in faster way
> 
> ex
> f[{1,2,1,2,1,2},{1,2}]-> True cause {1,2} is repated three times
> f[{1,2,3,1,2,3},{1,2,3}]-> True cause {1,2,3} is repeated two times
> f[{1,2,1,2,3},{1,2}]->False cause after two {1,2} there is another
> symbol.
> 
> True if the second list in containes many times exactly in first list
> False otherwise.
> 
> 
> bye everyone and sorry for my stupidity.
> 
> giampiero
> 
> 


  • Prev by Date: Re: the faster way to find repeated sublists
  • Next by Date: Re: Exporting PNGs with transparent backgroud?
  • Previous by thread: Re: the faster way to find repeated sublists
  • Next by thread: Pure Function for String Selection