I need to define a set of functions that are written in terms of common but lengthy expressions. To effect this, I want to inject abbreviations for such expressions into the RHS of SetDelayed of multiple functions. Something like this:
Clear[f, g]; Module[{abbrev = Sum[int[i], {i, 1, n}]}, f[n_] := abbrev + y; g[n_] := abbrev^2; (*and so on*) ] But it doesn't work. First, the n_ in the LHS is failing to match the n in the RHS. Second, the kernel first evaluates the RHS of abbrev before injecting it into the RHSs of f and g. In my program, that consumes time that could otherwise be saved.
What can I do to solve these problems?

Withisn't working on my computer (Mathematica 10.2 on Mac OS X). What version are you using? $\endgroup$int[i]is a recursively defined symbolic function (the result is usually a polynomial plus some logarithms),yis a similar object (polynomial+logs) but known explicitly (no recursive code). $\endgroup$(f[n_] := # + y; g[n_] := #^2;) &[ Sum[int[i], {i, 1, n}] ]there should be a duplicate somewhere. $\endgroup$