MathGroup Archive 2005

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

Search the Archive

Re: splitting sublists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58135] Re: splitting sublists
  • From: "dkr" <dkrjeg at adelphia.net>
  • Date: Sun, 19 Jun 2005 03:43:56 -0400 (EDT)
  • References: <d8rjme$isb$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

What you appear to want to do is find the longest sequence of integers
preceding each "x", enclose the sequence in a list, and delete the "x".

In[4]:=
 {{3,1,4,"x",1,5,9,2,"x"},{6,5,
"x",3,5,"x",8,9,"x"}}//.{a___?(!IntegerQ[#]&),
b__Integer,"x",c___}:>{a,{b},c}

Out[4]=
{{{3,1,4},{1,5,9,2}},{{6,5},{3,5},{8,9}}}


  • Prev by Date: associative arrays
  • Next by Date: Re: Baker-Campell-Hausdorff
  • Previous by thread: Re: splitting sublists
  • Next by thread: New Mathematica visualization website