I'm wondering how to do the following:
expr = L + R;
foo[L_, R_] := expr;
foo[1, 2]
(* L + R *)
and have it substitute the function variables into the expression. I realize that I could create dummy variables and do it like
foo[l_, r_] := expr /. L->l /. R->r
but my actual expression has a lot of free variables, and so I would like to know if there is a simpler way.
Evaluate. – chuy Jan 21 '14 at 17:45=instead of:=. It's not necessary toEvaluateIMO because it would be completely equivalent to just using=. I'd consider this question a duplicate of What is the difference between Set and SetDelayed?. – Szabolcs Jan 21 '14 at 19:30