Wow, I’ve been spending the last few days trying to understand metaprogramming in Julia and specifically Macros. Not much luck! Take the code below:
a = "p > 0.5"
function test(a)
for p in [0,1,2]
if @my_macro(a)
# evaluate here if p (in this scope) is larger than 0.5
end
end
end
How should my_macro look for this to work? Is this good practice? In reality I expect a to be a vector of several conditions on different variables which should all be fulfilled.
Thank you!