I have the following Function:
Testing[g[x_], y_] := Module[{s = x, t = y, c }, c = s + t ; c]
Which I am just trying to get to work before doing my actual application. It should accept a function g[x] and do stuff with it.
As a test, I try:
f[x_] := x^2;
Testing[f[x], 4]
But it just returns
Testing[x^2, 4]
which means that it does not understand what I mean...? What is the correct syntax to feed a mathematical function into my Function?
Testing
will only work for something with headg
whilef[x]
evaluates toPower[x,2]
. $\endgroup$Testing[x_, y_]
? $\endgroup$g[x]
, but with any kind of name (instead ofg
specifically) and any kind of variable, then you should useTesting[g_[x_], y_] := ...
. Moreover, you should probably makeTesting
HoldFirst
to keep the function from evaluating too early:SetAttributes[Testing, HoldFirst]
$\endgroup$