MathGroup Archive 2005

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

Search the Archive

Re: Unsorted Union


Hi,

the definition of f[] store every argument of f[]
and if f[] is called the first time with a argument
z it return z, for the second call of f[z] it return
a Sequence[] and not z, so that the second (and any future)
appearence of z in x is removed.

Regards
  Jens

"Robert Schoefbeck" 
<schoefbeck at hep.itp.tuwien.ac.at> schrieb im 
Newsbeitrag news:dj4p6t$gpt$1 at smc.vnet.net...
| 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
| 



  • Prev by Date: ListSurfacePlot3D
  • Next by Date: Re: Language vs. Library why it matters
  • Previous by thread: Re: Unsorted Union
  • Next by thread: Re: Unsorted Union