Sorry, while copying/pasting this line, which instantiates myfunc, got lost. (fixed there)
By the way, the most common way to pass functions with variable number of parameters (not variables) to inner functions, is by the use of closures: https://m3g.github.io/JuliaNotes.jl/stable/closures/
julia> const a = 1
1
julia> const b = 2
2
julia> f(x,a,b) = a*x + b*x^2
f (generic function with 1 method)
julia> function outer(f,x)
result = f(x)
return result
end
outer (generic function with 1 method)
julia> outer( x -> f(x,a,b), 5. )
55.0
If you need a variable number of variables, you can again resort to splatting (but this is much less common, and must be used with some care, because it might introduce performance problems if the number of parameters cannot be inferred at compile time):
julia> g(x,y,a,b) = x*a + y*b
g (generic function with 1 method)
julia> function outer2(f,x...)
result = f(x...)
return result
end
outer2 (generic function with 1 method)
julia> outer2( (x,y) -> g(x,y,a,b), 5., 10.)
25.0
julia> outer2( (x) -> f(x,a,b), 5.)
55.0