Trying to write my first macro and I’m surprised at just how hard it really is.
My goal is simple. I would like to be able to write something like the following
@∂(t)f(t,x,y)
and have it mean
AD.derivative(z -> f(z,x,y), t)
where AD
stands for the AbstractDifferentiation
module and z
stands for some macro-hygienic anonymous variable.
I’ve not been able to make this syntax work, however. I’ve tried to have @∂(t)
translate to some other macro that would then apply the necessary transformations to f
, but the way macros are processed has left me deeply confused.
This seems like a pretty simple and obvious use for a macro, right? Can anyone share any guidance on how I could do it?