Re: Detect pairs, tripples in a list
- To: mathgroup at smc.vnet.net
- Subject: [mg22523] Re: [mg22442] Detect pairs, tripples in a list
- From: Hans Friedrich Steffani <hans.steffani at e-technik.tu-chemnitz.de>
- Date: Thu, 9 Mar 2000 03:24:14 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On Sat, 4 Mar 2000, Wagner Truppel wrote: > if I understand correctly what you want to accomplish, the following > should work. Let t be the list you have, for instance, > > t = {1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, > 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0}; > > Then, the construct > > t //. { { x___, y_, y_, y_, z___ } /; ( y == 1 ) -> { x, T, z }, > { x___, y_, y_, z___ } /; ( y == 1 ) -> { x, D, z } } > Thanks again for this nice idea which I now got running for some testcases. However I am using this for a list with about 250000 elements which brought no result after 10min, so I stopped this. Hans Friedrich Steffani -- Hans Friedrich Steffani Institut fuer Elektrische Maschinen und Antriebe, TU Chemnitz mailto:hans.steffani at e-technik.tu-chemnitz.de http://www.tu-chemnitz.de/~hfst/