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? – QuantumDot Dec 21 '15 at 21:28int[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). – QuantumDot Dec 21 '15 at 21:35(f[n_] := # + y; g[n_] := #^2;) &[ Sum[int[i], {i, 1, n}] ]there should be a duplicate somewhere. – Kuba Dec 21 '15 at 21:36Withisn;t working on your computer. This would normally be done usingWith. Can you show us what you get? – Mike Honeychurch Dec 21 '15 at 22:07f[3]givesSum[int[i],{i,1,n}]+y. Thendidn't get replaced by3. – QuantumDot Dec 21 '15 at 22:13