1
$\begingroup$

If we only consider functions with two variables, I expect g[#1, #2] & is the same as g[##] &. But in the following example, they are not the same. Why?

expr = f[x, y] + D[f[x, y], x]
(* -> f[x, y] + Derivative[1, 0][f][x, y] *)

expr /. f -> (g[#1, #2] &)
(* -> g[x, y] + Derivative[1, 0][g][x, y] *)

expr /. f -> (g[##] &)
(* -> g[x, y] *)
$\endgroup$

Browse other questions tagged or ask your own question.