MathGroup Archive 2002

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

Search the Archive

Re: RE: And and Not for patterns

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36008] Re: [mg35980] RE: [mg35965] And and Not for patterns
  • From: BobHanlon at aol.com
  • Date: Mon, 12 Aug 2002 03:34:25 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dave's answer also works in patterns

Cases[{1, Sin[x], x, y, z}, 
    _?(MatchQ[#, _Symbol] && !MatchQ[#, x | y]&)]

{z}


Bob Hanlon
Chantilly, VA  USA

In a message dated 8/11/02 7:46:44 AM, djmp at earthlink.net writes:

>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
>


  • Prev by Date: re: Importing and computation
  • Next by Date: Re: Changing the default Input font
  • Previous by thread: Re: And and Not for patterns
  • Next by thread: Corresponding function to given values...