I'm trying to define a pattern matching function:
test[x__?MatchQ[Equal[_, _]]] := 1;
Now I give it a series of inputs, and expect each to output
test[1 == a, 1 == b] test[1 == a, 1 == a] test[1 == a, a == 1] test[1 == a]
...none of which evaluate to
1. I can't see what I've done wrong here. So I try the following:
MatchQ[Equal[_, _]][a == b]
False. I don't understand why. I look at the
a==b and it gives back
Equal[a,b] which should match with the pattern
However, for reasons beyond me, this expression...
MatchQ[Equal[_, __]][a == b]
I have no idea what's going on here or why my
test pattern match doesn't work. Can someone please explain what is going on? i.e.
- Why doesn't my
testpattern match work as intended?
- How can I pattern match a sequence of equalities
a==b, c==d ...?
- Why does