Bug fixed in 10.1
Consider the following pattern-matching expressions:
MatchQ[{1, 2}, {a_, b_}] (* True *)
MatchQ[{1, 2}, {a_, b_:0}] (* True *)
MatchQ[{1, 2}, {PatternSequence[a_, b_]}] (* True *)
MatchQ[{1, 2}, {PatternSequence[a_, b_:0]}] (* False *)
The last result surprises me. I would have expected it to return True
just like the others. I suspect a bug, but does this behaviour conform to some pattern-matching principle that I have overlooked?
MatchQ[{1, 2}, {PatternSequence[a_, b_.]}]
throws messages but returnsTrue
. $\endgroup$