# Making a function definition where the right hand side is evaluated before the definition is saved [closed]

My question is about assigning the resulting expression after evaluation of a function.

So what I want:

FOCf[x, y] := D[f[x, y], x]


such it immediately evaluates the right hand side, making it a conditional expression.

How I do it now.

I first shift-enter: D[f[x, y], x]. Then, I manually copy the resulting output to the right end of FOCf[x, y] :=.

Is there a better way to do this? I already tried using Evaluate, but that did not seem to work.

## closed as off-topic by m_goldberg, Pinti, MarcoB, Carl Lange, marchMar 1 at 17:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, Pinti, Carl Lange, march
If this question can be reworded to fit the rules in the help center, please edit the question.

• Is f defined prior to defining FOCf? – Edmund Feb 28 at 22:20
• Not sure how to interpret your question. You can evaluate in place with [Ctrl] + [Shift] + [Enter], or you can use = (without the colon) to first evaluate the r.h.s. and then assign the result to the l.h.s. symbol. Btw., normally you indicate variables with an underscore on the left side, e.g. FOCf[x_, y_]. – JEM_Mosig Feb 28 at 22:23
• Yes,f[x_, y_] := "conditional expression" before. I can also plot that one, so that seems fine. – Dick Oosthuizen Feb 28 at 22:24
• Thank you, I didn't know about the = . – Dick Oosthuizen Feb 28 at 22:28
• or you can write FOCf[x, y] := Evaluate @ D[f[x, y], x] – m_goldberg Mar 1 at 7:07