Re: Unsorted Union
- To: mathgroup at smc.vnet.net
- Subject: [mg61474] Re: Unsorted Union
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Wed, 19 Oct 2005 23:07:22 -0400 (EDT)
- Organization: Uni Leipzig
- References: <dj4p6t$gpt$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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 |