Re: split again

*To*: mathgroup at smc.vnet.net*Subject*: [mg73671] Re: [mg73622] split again*From*: Bob Hanlon <hanlonr at cox.net>*Date*: Sat, 24 Feb 2007 02:18:13 -0500 (EST)*Reply-to*: hanlonr at cox.net

Your zSplit is missing a & and even then would never result in lists longer than one whose elements are all less than or equal to 0.7 Using a different zSplit z=Table[Random[],{1000}]; zSplit=Split[z,#1<=0.7 === #2<=0.7&]; With this Split, lists longer than one can only contain elements less than or equal to 0.7 so it is unnecessary to test the elements' values. Select[zSplit,Length[#]>5&][[1]] {0.465823,0.397768,0.520191,0.0301858,0.516125,0.616719,0.133392,0.33706} Creating mixed lists zSplit=Split[z,#1<=0.7 && #2<=0.7||#1>0.7 && #2>0.7&]; Select[zSplit,Length[#]>5&&And@@Thread[#<=0.7]&][[1]] {0.465823,0.397768,0.520191,0.0301858,0.516125,0.616719,0.133392,0.33706} Bob Hanlon ---- Arkadiusz.Majka at gmail.com wrote: > Hi, > > Thank you very much for your help in my provious post. Now, consider > please a list > > z=Table[Random[],{1000}]; > > zSplit=Split[z,#1<=0.7 === #2>=0.7]; (bulit thanks to your > help) > > I want to pick the first sublist of zSplit that consists of elements > <= 0.7 and whose length is greater than a certain number (say 5). I > think that a good candidate would be using Cases and variations of _ , > but I don't know how. > > What I want to do (and what my both posts are about) is to find the > first sublist of z with all elements less than A and the length of > this sublist must be greater than B. Maybe there exists better > solution than to Split z in advance since what I need to do in my next > step is to find ONLY the FIRST sublist of splitted z. > > Thanks again, > > Arek