MathGroup Archive 2004

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

Search the Archive

Re: pattern matching and droping elements from list of lists.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49756] Re: [mg49742] pattern matching and droping elements from list of lists.
  • From: DrBob <drbob at bigfoot.com>
  • Date: Fri, 30 Jul 2004 06:02:09 -0400 (EDT)
  • References: <200407291146.HAA10396@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

Any of these (and many others) will do:

u = {a, b, c};
Outer[List, u, u, u] /. {x_, x_, x_} :> Hold[] // ReleaseHold
Outer[List, u, u, u] /. {Repeated[x_]} :> Sequence[]
DeleteCases[Outer[List, u, u, u], {x_, x_, x_}, Infinity]
DeleteCases[Outer[List, u, u, u], {Repeated[x_]}, {3}]

Bobby

On Thu, 29 Jul 2004 07:46:12 -0400 (EDT), sean kim <sean_incali at yahoo.com> 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
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: How to code Conjugate Gradient Method
  • Next by Date: DiscreteDelta Evaluation Question
  • Previous by thread: Re: pattern matching and droping elements from list of lists.
  • Next by thread: Re: pattern matching and droping elements from list of lists.