Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: split again

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73651] Re: split again
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 24 Feb 2007 02:07:27 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <ermd8n$hmd$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

you have forgotten a & and you mean

zSplit=Split[z,#1<=0.7 === #2>=0.7 &];

To get all sublists with Length[] >= n try
With[{n=2},
   Reap[If[Length[#] >= n, Sow[#]] & /@ zSplit][[2]]
   ]

and to get the first one

With[{n=2},
   Catch[If[Length[#] >= n, Throw[#]] & /@ zSplit]
]

Regards
   Jens

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
> 
> 


  • Prev by Date: Re: Help with Reduce Command.
  • Next by Date: Re: Custom sort a list of pairs
  • Previous by thread: Re: split again
  • Next by thread: Re: split again