If I have a function subF
that has some optional arguments, maybe (to get an MWE)
subF(a::Int; c::Int=13) = a+c
and in general the value 13
is a very good idea in general.
Now I write my main function (well one of them) F
for which 13
is not a good default but let’s say 2
, still I would like to be able to pass on the options. That I can do with
function F(b::Int; kwargs...)
# do something before and then:
subF(2*b; kwargs...)
end
with this I could do F(4)
which would call subF(8)
such that c
defaults to 13
. But for the call from within F
I would like that c
defaults to 2
or in other words if kwargs...
does not contain c
(but maybe options for F
or subF
) how can I set then c
in there to 2
?
More general: Is there a way to filter kwargs...
within F
such that I only pass valid options to subF
?