MathGroup Archive 1997

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

Search the Archive

Re: lists of pairs


Russell Towle wrote:

> Hi all, I have a problem in discarding duplicates from a list of
> integer
> pairs, where if pairs of the form {a, b} and {b,a} exist in the list,
> I
> wish to discard (or select) only one, it doesn't matter which.  The
> method
> I use below works, but is slow.
>
>

<snip>

> Suggestions?  It is desired to minimize the time it takes to do this.
>
> Russell Towle
> Giant Gap Press:  books on California history, digital topographic
> maps
> P.O. Box 141
> Dutch Flat, California 95714
> ------------------------------
> Voice:  (916) 389-2872
> e-mail:  rustybel at foothill.net
> ------------------------------

If z is your list of pairs with duplicates, how about Union[Map[Sort,z]]

Seth J. Chandler
Associate Professor of Law
University of Houston Law Center




  • Prev by Date: Q??: Solve::"eqf": "False is not a well-formed equation
  • Next by Date: Q: Union and precision.
  • Previous by thread: Re: lists of pairs
  • Next by thread: Re: lists of pairs