I understand that Attributes of Times make a bit non intuitive the Pattern Matching of its arguments. However I do not understand why this gives False:
MatchQ[Times[a, b, c], Times[___, b, ___]]
False
Can you explain it to me?
Answer
Times[___,b,___] // FullForm
Times[b,Power[BlankNullSequence[],2]]
MatchQ[Times[a, b, c], HoldPattern[Times[___, b, ___]]]
True
or
MatchQ[Times[a, b, c], Unevaluated[Times[___, b, ___]]]
True
Comments
Post a Comment