RE: And and Not for patterns
- To: mathgroup at smc.vnet.net
- Subject: [mg35980] RE: [mg35965] And and Not for patterns
- From: "David Park" <djmp at earthlink.net>
- Date: Sun, 11 Aug 2002 05:13:38 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Julio,
I don't think there is a direct analog but it is easy to make up something
that is equivalent. The following will return True for all Symbols that are
not x or y.
test1 := MatchQ[#1, _Symbol] && !MatchQ[#1, x | y] &
test1 /@ {1, Sin[x], x, y, z}
{False, False, False, False, True}
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Julio Vera [mailto:jvera at adinet.com.uy]
To: mathgroup at smc.vnet.net
Dear members,
There is an equivalent of Or (||) to be used with patterns: Alternative
(|). I couldn't find an equivalent for And (&&) and Not (!). I don't
know if they don't exist, or it is just that I can`t find them.
Thanks for your help,
Julio