I am trying to match against products of elements with a specific pattern. Since a product of symbols A B C
is just Times[A,B,C]
, I figured this could be done by treating Times
like any other symbol (here f
):
MatchQ[ f[a,b,c], f[_Symbol..] ]
>>> True
Woe, such a pattern doesn't seem to work for Times
:
MatchQ[ a b c, Times[_Symbol..] ]
>>> False
MatchQ[ Times[a, b, c], Times[_Symbol..] ]
>>> False
I suspect this may be due to some property of Times
related to its commutativity, though there's no auto-commuting in this example!
a b c // FullForm
>>> Times[a, b, c]
How can I produce the desired pattern for matching repeated-pattern arguments of Times
?