Consider
{x->1}
which has FullForm
List[Rule[x, 1]]
and, therefore,
MatchQ[{x->1}, List[___Rule]]
produces True
.
Now consider
<|x->1|>
which has FullForm
Association[Rule[x, 1]]
but
MatchQ[<|x->1|>, Association[___Rule]]
produces False
In fact,
MatchQ[<|x->1|>, Association[___]]
produces False
. Any ideas? (I'm trying to make some MathLink xxxxxxxx WSTP functions for serializing C structs as Associations, and this lacuna is messing me up).
MatchQ[ Normal @ <|x->1|>, Normal @ Association[ x -> _ ]
orMatchQ[ Normal @ <|x->1|>, List[ ___ Rule] ]
will work though. $\endgroup$