Re: Bug in Pattern Matching with Condition?
- To: mathgroup at smc.vnet.net
- Subject: [mg97344] Re: Bug in Pattern Matching with Condition?
- From: Raffy <raffy at mac.com>
- Date: Wed, 11 Mar 2009 04:25:03 -0500 (EST)
- References: <goqpe7$lrn$1@smc.vnet.net> <goqugt$ngp$1@smc.vnet.net>
On Mar 10, 3:32 am, dh <d... at metrohm.com> wrote: > Hi Jens, > > can you elaborate a bit. According to the definition of Verbatim , > > Verbatim[Condition][_, _]] should match literally "Condition][_, _]" and > > not Condition[a, b]. Therefore it looks more like another bug to me an= d > > adds to the mystery of why MatchQ[Condition[a, b], Condition[_, _]] > > evaluates to False. > > Daniel > > > > Jens-Peer Kuska wrote: > > Hi, > > > but > > > MatchQ[Condition[a, b], Verbatim[Condition][_, _]] > > > Regards > > Jens > > > cesar wrote: > >> Hi Mathematica group, do you get any idea of > >> why the following sentences don't give true? > > >> MatchQ[Condition[a, b], Condition[_,_]] > >> MatchQ[Condition[a, b], Condition[__]] > >> MatchQ[Condition[a, b], HoldPattern[Condition[__]]] > > >> Is this a bug? > > >> Cheers, > >> Cesar As I said above, as a pattern, Condition[_,_] cannot match anything by definition. Since, Condition[_,_] => _ /; _ where the second _ must evaluate to true for the rule to be accepted. Since _ is obviously not true, the rule can never be true. If you want to use pattern matching to match Condition, I'd recommend swapping its head with something else.