Re: pattern matching and droping elements from list of lists.
- To: mathgroup at smc.vnet.net
- Subject: [mg49759] Re: [mg49742] pattern matching and droping elements from list of lists.
- From: Ken Levasseur <klevasseur at mac.com>
- Date: Fri, 30 Jul 2004 06:02:11 -0400 (EDT)
- References: <200407291146.HAA10396@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Sean:
Try this:
Outer[List, {a,b,c}, {a,b,c}, {a,b,c}]]]//
Flatten[#, 2] &//
Select[#, Not[SameQ @@ #]& ] &
{{a, a, b}, {a, a, c}, {a, b, a}, {a, b, b}, {a, b, c},
{a, c, a}, {a, c, b}, {a, c, c}, {b, a, a}, {b, a, b},
{b, a, c}, {b, b, a}, {b, b, c}, {b, c, a}, {b, c, b},
{b, c, c}, {c, a, a}, {c, a, b}, {c, a, c}, {c, b, a},
{c, b, b}, {c, b, c}, {c, c, a}, {c, c, b}}
Ken Levasseur
Math. Sci.
UMass Lowell
On Jul 29, 2004, at 7:46 AM, sean kim wrote:
> hello group,
>
> Outer[List, {a, b, c}, {a, b, c}, {a, b, c}]
>
> will output
>
> {{
> {{a, a, a}, {a, a, b}, {a, a, c}}, {{a, b, a}, {a, b, b}, {a, b, c}},
> {{a, c, a}, {a, c, b}, {a, c, c}}},
> {{{b, a, a}, {b, a, b}, {b, a, c}}, {{b, b, a}, {b, b, b}, {b, b, c}},
> {{b, c, a}, {b, c, b}, {b, c, c}}},
> {{{c, a, a}, {c, a, b}, {c, a, c}}, {{c, b, a}, {c, b, b}, {c, b, c}},
> {{c, c, a}, {c, c, b}, {c, c, c}}
> }}
>
> how do I remove {a,a,a} and {b,b,b} and {c,c,c} from above?
>
> thanks all in advance for any insights
>
> sean
>
- References:
- pattern matching and droping elements from list of lists.
- From: sean_incali@yahoo.com (sean kim)
- pattern matching and droping elements from list of lists.