0

Consider the following code:

f[x_]:= SomeCodeAbout[x]
g[x_]:= f[x]

It links g with f, namely when g is called, f runs, and so will SomeCodeAbout[x]. However, if I want just to store the result of f[x], which could be some simple expression after running the SomeCodeAbout[x], into g[x], what should I do (without manually copying the result and defining g)? The reason is simple, since SomeCodeAbout[x] could take a long time to run which is inefficient especially when g is used frequently.

Lelouch
  • 533
  • 3
  • 9

0 Answers0