MathGroup Archive 2002

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

Search the Archive

Re: Keepping order with Union

  • To: mathgroup at
  • Subject: [mg32655] Re: Keepping order with Union
  • From: "Ersek, Ted R" <ErsekTR at>
  • Date: Fri, 1 Feb 2002 16:11:03 -0500 (EST)
  • Sender: owner-wri-mathgroup at

Dave Snead wanted a function that throws out duplicate elements in a list
and keeps the original order of the elements that remain.  There was a long
thread on this subject about two years ago and much of it is summarized at 
Many agree that the best way to do this is with the following ingenious
function written by Carl Woll.



In[]:= DeleteRepetitions[ {3,1,1,6,3,2,1,1,8,2,6,8} ]

Out=  {3,1,6,2,8}

That's one of the best Mathematica tricks I have seen.

   Ted Ersek 
   Get Mathematica tips, tricks from

  • Prev by Date: Re: Keeping order with Union
  • Next by Date: Simple integral problem
  • Previous by thread: Re: How to draw such 3D surface?
  • Next by thread: Simple integral problem