5

Can anyone explain why the following pattern matches:

[In1]:MatchQ[Hold[a + c + b], Hold[x_ + b + a]]
[Out1]:True

But this one fails:

[In1]:MatchQ[Hold[c + b + a], Hold[x_ + b + a]]
[Out1]:False

It seems that the pattern matcher tries all permutations even if the Plus expression is held (case 1), so why does it fail for case 2?

Many thanks for your help

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
user61796
  • 51
  • 1

0 Answers0