MathGroup Archive 2008

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

Search the Archive

Re: Match Pairs of Numbers


Andrew Beveridge wrote:
> Any help would be appreciated.
> 
> I am using Mathematica 5.2 & 6.0
> 
> I am having trouble finding the correct form of Pattern Matching for 
> pairs of Numbers. I do not know whether to use Select, Cases, Pick, 
> etc. I am also unsure how to set the pattern matching argument.
> 
> Assume I have the list
> 
> lst = {{1,1}, {1,2}, {1,3}, {1,4}, {2,2}, {3,1}, {3,2}, {3,3}, {4,1}, {4,4}}
> 
> 
> I would like to match/select pairs that have the same set of numbers 
> only reversed, that is, the selection would find
> 
> {{1,3}, {3,1}, {1,4}, {4,1} }
> 

Intersection[lst, Reverse /@ lst]

Select[%, UnsameQ @@ # &]


  • Prev by Date: Using ShowLegend with MultipleListPlot
  • Next by Date: Re: Tagged list processing
  • Previous by thread: Re: Match Pairs of Numbers
  • Next by thread: Re: Match Pairs of Numbers