Re: Cases
- To: mathgroup at smc.vnet.net
- Subject: [mg50454] Re: [mg50423] Cases
- From: "David Park" <djmp at earthlink.net>
- Date: Sat, 4 Sep 2004 01:43:37 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Jerry,
x = {a, b, c, d, d};
Not[d] // FullForm
Not[d]
I don't see any of those in the list.
Cases[x, a_ /; a =!= d]
{a, b, c}
This method might be easier.
Clear[x]
{a, 0, b, 0, d} == {x, 0, y, 0, z} // Thread
% /. True -> Sequence[]
{a == x, True, b == y, True, d == z}
{a == x, b == y, d == z}
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Blimbaum, Jerry AA R22 [mailto:jerry.blimbaum at navy.mil]
To: mathgroup at smc.vnet.net
Given: x = {a,b,c,d,d};
Applying Cases[x,d] gives an output of {a,b,c}......
However, Cases[x,Not[d]] gives as output an empty list { }... I
expected {a,b,c}.....
Why didnt I get that?
This issue came up when using Thread on vectors...and in some cases the
Thread resulted in 0 == 0 so it's output in the list was
True....and I
wanted to remove them....
thanks.....jerry blimbaum