I have defined a function
fun[f_[x_,y_]]. When I call it, I want to wrap everything by
But the above expression looks clumsy, especially if the arguments of
fun is more complicated. Is there a more elegant way to do it?
A simple example of the function
fun is as follows. The last line is what I expect to get.
fun[f_[x_, y_]] := ToExpression[ToString[f] <> ToString[x] <> ToString[y]] f = 1; x = 1; y = 1; fun[f[x, y]] (* -> 111 *) fun[Unevaluated[f][Unevaluated[x], Unevaluated[y]] (* -> fxy *)
I tried several ways by using a single
HoldPattern, and they do not work.