Re: Or in a Select question
- To: mathgroup at smc.vnet.net
- Subject: [mg67088] Re: [mg67066] Or in a Select question
- From: "Carl K. Woll" <carlw at wolfram.com>
- Date: Fri, 9 Jun 2006 01:07:24 -0400 (EDT)
- References: <200606080854.EAA12393@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
János wrote: > Hi, > > I have a list > > lst={a,b,c} > > I make another list from it the following way: > > In[2]:= > pp = Partition[Tuples[lst, > 2], 2, 1] > Out[2]= > {{{a, a}, {a, b}}, > {{a, b}, {a, c}}, > {{a, c}, {b, a}}, > {{b, a}, {b, b}}, > {{b, b}, {b, c}}, > {{b, c}, {c, a}}, > {{c, a}, {c, b}}, > {{c, b}, {c, c}}} > > From here I would like to select all the elements whose sublists > contain only different elements. So my "logical" selection was: > > In[54]:= > Select[pp, > #1[[1,1]] =!= #1[[1,2]] || ^^ || Use && instead of || here. > #1[[2,1]] =!= #1[[2, > 2]] & ] > Out[54]= > {{{a, a}, {a, b}}, > {{a, b}, {a, c}}, > {{a, c}, {b, a}}, > {{b, a}, {b, b}}, > {{b, b}, {b, c}}, > {{b, c}, {c, a}}, > {{c, a}, {c, b}}, > {{c, b}, {c, c}}} > [snip] Carl Woll Wolfram Research
- References:
- Or in a Select question
- From: János <janos.lobb@yale.edu>
- Or in a Select question