MathGroup Archive 2005

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

Search the Archive

Re: splitting sublists


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