MathGroup Archive 2011

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

Search the Archive

Re: Delete elements from list..

  • To: mathgroup at
  • Subject: [mg117027] Re: Delete elements from list..
  • From: Peter Pein <petsie at>
  • Date: Tue, 8 Mar 2011 05:34:11 -0500 (EST)
  • References: <ijv047$68v$> <ik00i6$e6k$> <il2dau$66o$>

Am 07.03.2011 11:51, schrieb BoLe:
> On Feb 22, 10:44 am, Ray Koopman<koop... at>  wrote:
>> Union@FoldList[Max,First@mylist,Rest@list]
> Wov, that is elegant to me, and fast. DeleteDuplicates speeds it a
> tiny bit up. ;-) Since Union sorts the result (already sorted in this
> case) or does it do something else too?

DeleteDuplicates is much slower here:

In[9]:= mysecondlist=RandomInteger[{0,99},{2000}];

Out[10]= {1.139,{79,98,99}}

In[11]:= Timing[Do[u2=DeleteDuplicates[mysecondlist,#2<=#1&],{1000}];u2]
Out[11]= {33.026,{79,98,99}}


P.S.: This computer has been slowed down due to thermal problems.

  • Prev by Date: Re: Reduce a vector eliminating equal components
  • Next by Date: Re: want to limit range of shading in contour plot
  • Previous by thread: Re: Delete elements from list..
  • Next by thread: Re: Delete elements from list..