I would like to build automatically many Julia functions (metaprogramming) to wrap a library.
Here is the function I would like to generate:
function myfunc(a::Array{Float64,1}, b::Array{Float64,1}; x=Int64(1), y=Float64(2))
x + y
end
here are parameters of the function I would like to use to generate such a function.
funcname = :my_func
args = (:a, :b)
args_typ = (Array{Float64,1}, Array{Float64,1})
kw_args = (:x, :y)
kw_defval = (1, 2)
kw_typ = (Int64, Float64)
I don't feel confortable with Julia macro and http://docs.julialang.org/en/release-0.4/manual/metaprogramming/ doesn't help me much.
I also would like to be able to display function (generated) code.
My first idea (not very automated) was
macro GEN_FUNC(funcname)
function $funcname(a, b, x=1, y=2)
return x
end
end
but it raises
ERROR: syntax: invalid method name "$funcname"