Thank you abraemer for taking the time to look at my code, however briefly. Thank you to the entire community as well for giving me this rubberducking opportunity. Explaining what I didn’t like about my code crystallized how I could improve it. I didn’t like how I dissected simple functions because I couldn’t extract their body as an AST. Quoting them was the obvious work-around but I approached it the wrong way. I didn’t need to rewrite every function as quoted body and args then generate them later. Instead, I can quote the entire chunk of code where those functions are defined so I can evaluate it and access their bodies by walking the AST. 0e00457 looks much more like e3e5bc7 with
matchers = quote
# all function definitions
end
exprs = Dict{Symbol,Tuple{Expr,Vararg{Expr}}}(
expr.args[1].args[1] => (expr.args[2], expr.args[1].args[2:end-4]...)
for expr in matchers.args if is_expr(expr, :function)
)
eval(matchers)
I like this better because it’s so much less intrusive.