MatchQ[Hold[1 + 2], Hold[2 + 1]]
returns False
. But in the presence of a Blank[]
in the matching pattern as in the example below
MatchQ[Hold[1 + 2], Hold[2 + _]]
which returns True
, apparently the fact that Plus
is Orderless
is being respected.
Apart from doing something like removing the Orderless
attribute from Plus
, how can I make the order matter when pattern-matching in a case like this? Where can I read more about this in the documentation?