MathGroup Archive 2005

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

Search the Archive

Re: splitting sublists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58042] Re: [mg58033] splitting sublists
  • From: Andrzej Kozlowski <andrzej at akikoz.net>
  • Date: Thu, 16 Jun 2005 07:19:36 -0400 (EDT)
  • References: <200506160938.FAA18542@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 16 Jun 2005, at 18:38, hrocht at mail15.com wrote:

> hi
> how to split the sublists inside a bigger list wherever we find "x"
> letter
> {{3,1,4,"x",1,5,9,2,"x"},{6,5,"x",3,5,"x",8,9,"x"}}
> the results will be:
>
> {{{3,1,4},{1,5,9,2}},{{6,5},{3,5},{8,9}}}
>
> best regards
> and thanks for this great group
> anton
>
>


DeleteCases[Split[#,#1=!="x"&&#2=!="x"&]&/@{{3,1,4,"x",1,5,9,2,"x"}, 
{6,5,"x",3,5,"x",
     8,9,"x"}},{"x"},Infinity]


{{{3, 1, 4}, {1, 5, 9, 2}}, {{6, 5}, {3, 5}, {8, 9}}}

Andrzej Kozlowski

Chiba, Japan


  • Prev by Date: Re: For Loop and Array related
  • Next by Date: Re: List operations
  • Previous by thread: splitting sublists
  • Next by thread: Re: splitting sublists