julia> using Zygote
julia> fs = Dict("sin" => sin, "cos" => cos);
julia> derivative(x -> fs[readline()](x), 1.0)
cos
-0.8414709848078965
julia> -sin(1.0) # 'true' derivative in 1.0
-0.8414709848078965
So Zygote can apply AD to an anonymous function that looks up a function in a hash table from user input.