Re: Why does this pattern fail to match?
- To: mathgroup at smc.vnet.net
- Subject: [mg114259] Re: Why does this pattern fail to match?
- From: Richard Fateman <fateman at cs.berkeley.edu>
- Date: Mon, 29 Nov 2010 06:07:06 -0500 (EST)
- References: <email@example.com> <firstname.lastname@example.org> <email@example.com>
On 11/28/2010 3:56 AM, kj wrote: > On Nov 25, 11:57 am, kj<no.em... at please.post> wrote: >>> I'm tearing my hair out over this one. Could someone please explain >>> to me why all the following MatchQ expressions >>> You are, I think, looking for an algorithm for UNIFICATION which would tell you under what conditions there exists a single expression that satisfies both patterns. Unification is not the same as pattern matching one pattern to some expression. Since Mathematica conflates the notion of pattern with that of expression (with some benefits), it is possible to write down commands like your MatchQs which in reality (i.e. implementation) don't match your mental assumptions about what is happening. A rule of thumb: don't have any "_" characters in expressions. they belong in patterns. [yes, it COULD be meaningful to violate this rule. ] RJF