MathGroup Archive 2005

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

Search the Archive

Re: Unsorted Union

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61494] Re: Unsorted Union
  • From: Konstantin L Kouptsov <klk206 at panix.com>
  • Date: Wed, 19 Oct 2005 23:08:14 -0400 (EDT)
  • References: <dj4p6t$gpt$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Robert Schoefbeck wrote:
> Hello all,
> 
> in the help section i found the following thing:
> 
> UnsortedUnion[x_] := Module[{f}, f[y_] := (f[y] = Sequence[]; y); f/@x]
> 
> It does just what it says:
> UnsortedUnion[{a,c,b,d,a,b}]={a,c,b,d}
> 
> (ordinary Union would Sort the result)
> 
> my question is: How does the definition work? I know all the syntax
> and i have been using these concepts for for some time now. But i cant 
> figure out what this definition does.
> 
> Robert
> 

Actually, it soes not:

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


  • Prev by Date: Set construction with condition
  • Next by Date: Re: Use strings in Mathematica, like in C?
  • Previous by thread: Unsorted Union
  • Next by thread: Re: Unsorted Union