[Date Index] [Thread Index] [Author Index]
Re: Why does this pattern fail to match?
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