I am trying to define a function which one of its arguments is a class of other functions, with diverse parameters (for example, distribution functions). So, I don’t know how to pass these parameters because the parameters, according to the distribution, doesn’t have the same pattern. For example
function foo(;distribution::Function, x = 0, parameters)
y = x + rand(distribution (parameters) )
return y
end
In this case, I need to execute, for example:
# For normal(0,1)
foo(Normal, x = 2, 0,1)
# Or for normal(1,2)
foo(Normal, x = 2, 1,2)
Or
# For TDist(ν)
foo(TDist, x = 4, ν = 2 )
I spent some time looking for a solution, but I couldn’t find it. I would like a solution to include as arguments not only distributions and their parameters, but any kind of functions with several parameters.