Thanks, one thing I forgot to mention is that I want to pass this myf as an argument to another function (e.g. like LinearCG which takes functions as input). Macros cannot handle this I guess.
Note you have to be careful about the the type expected by the other function, and the type of the arguments as well… For example,
if the function should be real, with real argument