I am not so familiar to Julia.
I have a program as follows, it means function t2 is a parameter of t5.
My question is that why it needs (args...; kwargs...) -> begin in beginning of t5 , and why here is ;, if it is (args..., kwargs...) -> begin ,there will be erros.
Thanks for your help.
function t5(t2, x,y)
(args...; kwargs...) -> begin
return t2(args..., kwargs...)+x+y
end
end
function t2(theta,gamma)
return theta*gamma
end
t5(t2, 3, 4)(2,5)
In Julia, functions get both positional arguments and keyword arguments. When defining a function, the positional arguments are defined first and then a semicolon ; separates them from the keyword arguments declaration.
When calling functions, the same convention is used, except the ; can be replaced with a ,. Probably for backward compatibility reasons, and possibly to make calls look nicer. When using the splat (...) operator for kwargs this is no longer optional, as Julia will interpret the expanded kwargs as positional parameters with no ;.