At some point in my program I create expressions (and store them inside variable (which is inside a struct)). At some later point I wish to do some light manipulations of these expressions and execute the resulting code. How do I do this?
ex = :(F(x)=2x+1) macro inc1(ex_func) exx_func = deepcopy(ex_func) exx_func.args.args.args += 1 return exx_func end ... @inc1 ex
inc1 only sees the symbol
:ex, likvise if I try
$ex it only sees that, but not the content of the expression
Is this even possible/recommended with macros? I can achieve the same thing with a normal function and then an
eval at the end. However, when I first started with metaprogramming I learnt something about eval’s being dangerous and to avoid them.