MathGroup Archive 2004

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

Search the Archive

Re: Return different values of a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49432] Re: [mg49425] Return different values of a list
  • From: Adriano Pascoletti <pascolet at dimi.uniud.it>
  • Date: Tue, 20 Jul 2004 07:53:20 -0400 (EDT)
  • References: <200407191146.HAA09125@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Il giorno 19/lug/04, alle 13:46, Dr. Wolfgang Hintze ha scritto:

> {a,b,c,a,c}

Wolfgang,

if you have Mathematica v. 5 the help of Reap contains a very fast  
solution, namely

UnsortedUnion[x_] := Reap[Sow[1, x], _, #1 &][[2]]

In[171]:=
UnsortedUnion[{a,b,c,a,c}]

Out[171]=
{a,b,c}


------------------------------------------------------------------------ 
--------

Adriano Pascoletti
Dipartimento di Matematica e Informatica
Universita' di Udine
Via delle scienze 206
I-33100 Udine
Italy



  • Prev by Date: Re: Return different values of a list
  • Next by Date: 7 equations and 7 unknowns (non-linear equations)
  • Previous by thread: Re: Return different values of a list
  • Next by thread: Re: Return different values of a list