MathGroup Archive 1997

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

Search the Archive

Re: Partition List


So many partition lists :)

While Split[m, #2 != 10 &] seems much neater than the other
functional solutions posted, it is alas also much slower.

For instance:

   m = Table[Random[Integer, {1, 50}], {100000}];


Timing[p = Flatten[Position[m, 10]]; 
   MapThread[Take[m, {#1, #2}]&, {Prepend[p, 1], Append[p-1, Length[m]]}]; ]

Out[42]=   {0.39*Second, Null}


vs

Split[m,#2!=10&]; // Timing

Out[44]=   {2.03333 Second,Null}



Cheers

Colin

-- 
Colin Rose 
tr(I) - Theoretical Research Institute
______________________________________
crose at c2.telstra-mm.net.au
http://www.usyd.edu.au/su/tri/


  • Prev by Date: Notation package
  • Next by Date: Re: Flat: Problems & Workarounds Sweden.
  • Previous by thread: Notation package
  • Next by thread: Loading Standard Packages