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

```

• Prev by Date: Re: Plotting Cosh(x)?
• Next by Date: Formatted Date String
• Previous by thread: Or in a Select question
• Next by thread: Re: Or in a Select question