# Can't match custom head in function signature [closed]

I have written a financial charting function which has the following signature;

Chart[
data_List,
indicators_List: {},
glyphs_List: {},
chartTitle_String: "untitled"
]


This function works fine when I call it. I now want to make the signature more restrictive, specifically, I want glyphs to now match on a list of none or more of the custom head _Glyph. In other words;

Chart[
data_List,
indicators_List: {},
glyphs: {_Glyph...}: {},
chartTitle_String: "untitled"
]


To confirm the pattern matches, I have the sample argument

glyphs10m = {Glyph["RelativeHigh", 5, 5, 36.72]}

In[152]:= MatchQ[glyphs10m, {_Glyph ...}]

Out[152]= True


I can call the function with the first signature and it produces the correct output. If I use the second signature with the same arguments however, the expression returns as if it has failed to find a match, e.g.

In[168]:= Clear@"PA"
<< PA
Chart[data10mV, highs10, glyphs10m, "variable arguments"]

Out[170]= Chart[{{{2008, 1, 2, 14., 31., 0.}, {36.67, 36.69, 36.61,
36.65, 20800.}}, {{2008, 1, 2, 14., 32., 0.}, {36.68, 36.71,
36.68, 36.68, 2600.}}, {{2008, 1, 2, 14., 33., 0.}, {36.71, 36.71,
36.67, 36.67, 1700.}}, {{2008, 1, 2, 14., 34., 0.}, {36.68,
36.72, 36.68, 36.69, 700.}}, {{2008, 1, 2, 14., 35., 0.}, {36.7,
36.72, 36.66, 36.66, 2800.}}, {{2008, 1, 2, 14., 36., 0.}, {36.68,
36.68, 36.64, 36.66, 6200.}}, {{2008, 1, 2, 14., 37.,
0.}, {36.68, 36.68, 36.66, 36.67, 2900.}}, {{2008, 1, 2, 14., 38.,
0.}, {36.66, 36.67, 36.63, 36.67, 1400.}}, {{2008, 1, 2, 14.,
39., 0.}, {36.67, 36.68, 36.65, 36.68, 2500.}}, {{2008, 1, 2, 14.,
40., 0.}, {36.67, 36.68, 36.63, 36.68, 13000.}}}, {36.69, 36.71,
36.71, 36.72, 36.72, 36.68, 36.68, 36.67, 36.68,
36.68}, {Glyph["RelativeHigh", 5, 5, 36.72]}, "variable arguments"]


I feel I'm missing something basic and would be very happy if someone could point it out to me.

Thanks.

• MMA 12.3 Both versions of Chart work with the data from "Out[170]". Try with a new kernel. Nov 3 '21 at 11:58
• MMA 12.1.1 - tried with new kernel. Still doesn't work. If I replace {_Glyph...} with {_...} it works fine. Nov 3 '21 at 13:30
• Doh! I've found the problem. Sorry, I should have mentioned that the code I was running is in a package. Glyph is called in a notebook which makes it a global symbol so I need to use {_Global`Glyph...}. Sorry for that and thank you for your help Daniel - it convinced me that there is something wrong with my code and not MMA. Nov 3 '21 at 13:40