Skip to main content
2 of 3
Added example use of code.
Somos
  • 5.1k
  • 1
  • 10
  • 16

There is more than one way to do things in Mathematica. A simple example code

build[a_, b_, x_] := a + b x;
exprList = Table[build[a, b, x], {a, 3}, {b, 3}];
exprFunc[a_, b_, v_] := Block[{x = v}, exprList[[a, b]]];
exprFunc[1, 2, u] == 1 + 2 u

returns True. The initial problem you encountered was the Evaluate[exprList[[a, b]]] which was being evaluated in defining the exprFunc but a and b were not defined yet. You want to avoid using Evaluate and use Block instead to give a local value of the variable x. The documentation for Evaluate shows that it is only needed for some special cases to override Holds.

Somos
  • 5.1k
  • 1
  • 10
  • 16