5
 In[1] := Hold[a.b] // FullForm
Out[1] := Hold[Dot[a,b]]

So far so good.

 In[2] := Hold[a_.b_] // FullForm
Out[2] := Hold[Times[Optional[Pattern[a,Blank[]]],Pattern[b,Blank[]]]]

Why does the Dot become Times? I have a feeling it has something to do with the Optional that also appears, but I can't find anything that explains what's going on in the documentation.

Dan
  • 245
  • 1
  • 5

1 Answers1

8

See the documentation for Optional:

The special form s_. is equivalent to Optional[s_] and can be used to represent function arguments which, if omitted, should be replaced by default values globally specified for the functions in which they occur.

This explains the result your are receiving.

Thus, it seems you have a precedence problem, and a possible workaround is:

Hold[(a_).(b_)] // FullForm

and get

Hold[Dot[Pattern[a, Blank[]], Pattern[b, Blank[]]]
István Zachar
  • 47,032
  • 20
  • 143
  • 291
Pinguin Dirk
  • 6,519
  • 1
  • 26
  • 36