Re: Keeping order with Union
- To: mathgroup at smc.vnet.net
- Subject: [mg32595] Re: [mg32590] Keeping order with Union
- From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
- Date: Thu, 31 Jan 2002 01:45:17 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
This is the question that in 1999 elicited a real jem of a solution from Carl Woll: OrderedUnion[li_]:=Block[{i,Sequence}, i[n_]:=(i[n]=Sequence[];n);i/@li] Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ On Wednesday, January 30, 2002, at 05:19 PM, Dave Snead wrote: > I'd like a function that throws out duplicate entries in a list and > keeps > the > original list order. (when it sees 2 equal entries it throws out the > one > that is later in the list). I'd use Union, but it sometimes changes > the > order of the elements in the list. What's the tersest way to do this? > Thanks in advance, > Dave Snead > > > > > >