Hi,
> Thanks for all the responses! Very insightful.
>
> Here's one more thing I can't figure out:
>
> testFunction[f_][x_, y_] = Module[{},
> Print[f[x, y]];
> 5
> ];
> testFunction[ArcTan][x, y]
>
> Why doesn't this function print out ArcTan[x, y]?
it does, but since you used Set it does the Print when the definition is
evaluated, not when the function call is evaluated. In the rule that is
defined, Print isn't contained (in this case the rule is saved in
SubValues, which is a rather dark area of Mathematica with not much
documentation -- for many versions/years):
In[7]:= SubValues[testFunction]
Out[7]= {HoldPattern[testFunction[f_][x_, y_]] :> 5}
What you probably wanted would be:
testFunction[f_][x_, y_] := (Print[f[x, y]]; 5);
which does Print when the function call is evaluated. (note that I
omitted the Module with no variables, which doesn't do anything). Here
is what the SubValues look like for that case:
In[9]:= SubValues[testFunction]
Out[9]= {HoldPattern[testFunction[f_][x_, y_]] :> (Print[f[x, y]]; 5)}
hth,
albert