Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Unsorted Union

  • To: mathgroup at
  • Subject: [mg61486] Re: [mg61434] Unsorted Union
  • From: "David Park" <djmp at>
  • Date: Wed, 19 Oct 2005 23:07:45 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


This was one of Carl Woll's ingenious routines.

The first time f hits a value y it establishes a definition but returns y.
The next time it hits a y the definition already exists and it returns
Sequence[]. An empty Sequence is simply elimited from a list of items. This
is very fast but it does use some storage space to store all the

David Park
djmp at

From: Robert Schoefbeck [mailto:schoefbeck at]
To: mathgroup at

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:

(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.


  • Prev by Date: Re: Desperate help
  • Next by Date: Re: Unsorted Union
  • Previous by thread: Re: Unsorted Union
  • Next by thread: Re: Unsorted Union