MathGroup Archive 2007

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

Search the Archive

Re: split again

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73679] Re: [mg73622] split again
  • From: János <janos.lobb at yale.edu>
  • Date: Sat, 24 Feb 2007 02:22:33 -0500 (EST)
  • References: <200702230936.EAA17604@smc.vnet.net>

On Feb 23, 2007, at 4:36 AM, 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
>

Here is a newbie approach:

In[8]:=
zs = First[Select[Split[z,
      #1 <= 0.7 && #2 <=
         0.7 & ],
     Length[#1] > 5 & ]]

J=E1nos


------------------------------------------
"The shortest route between two points is the middleman"  Ayn Rand



  • References:
  • Prev by Date: Re: Custom sort a list of pairs
  • Next by Date: Re: Automatic Notebook Evaluation
  • Previous by thread: split again
  • Next by thread: Re: split again