I'm trying the following pattern matching command:
ReplaceList[Hold[b + a], Hold[x___ + y___] -> {{x}, {y}}]
And Mathematica returns:
{{{}, {b, a}}, {{b}, {a}}, {{a}, {b}}, {{b, a}, {}}}
Can someone help me to understand why {{}, {a, b}}
and {{a, b}, {}}
don't belong to the solution?
As Plus
head has Orderless
attribute, the pattern matcher should try all permutations (and this explains why {{}, {a, b}}
belongs to the solution). Where am I wrong?
Thanks for your help.
{a, b}
and{b, a}
are equivalent. They are (probably) considered identical in pattern matching to reduce combinatorial explosion of cases. $\endgroup$