MathGroup Archive 1999

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

Search the Archive

Fast List-Selection

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19880] Fast List-Selection
  • From: Hans Havermann <haver at total.net>
  • Date: Sun, 19 Sep 1999 18:47:32 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

I have a list 's' composed of a large number of (small) integers. I wish to
search this list for instances of 7 consecutive, identical elements.

My approach is:

Do[If[Count[t = Take[s, {i, i + 6}], t[[1]]] == 7,
    Print[i]], {i, 1, Length[s] - 6}]

Can anyone think of a *faster* way of doing this?




  • Prev by Date: Re: Freeing memory in Mathematica
  • Next by Date: Re: questions about delayed expression.
  • Previous by thread: Re: Bode-Diagrams
  • Next by thread: Re: Fast List-Selection