I am trying to provide a feature to allow a user to supply a function expression and have that expression evaluated at runtime.
The function needs two arguments,
n. Both are assigned values before the evaluation.
function calculate(e::Expr) m = rand(1:4, 5, 5) n = rand(0:1, 5, 5) return eval(e) end
Why does the following not work?
d = :(rank(m * n)) julia> calculate(d) ERROR: UndefVarError: m not defined Stacktrace:  top-level scope at none:0  eval at ./boot.jl:330 [inlined]  calculate(::Expr) at ./none:6  top-level scope at none:0