How to splat named tuples into functions?

I’d like to be able to do something like this:

using NLsolve

function f!(F, x)
    F[1] = (x[1]+3)*(x[2]^3-7)+18
    F[2] = sin(x[2]*exp(x[1])-1)
end

opts = (method=:newton, autodiff=:forward)

# i'd like to be able to do something like this:
nlsolve(f!, [1.0, 1.0], opts...)

Just use a semicolon to separate the keyword arguments:
nlsolve(f!, [1.0, 1.0]; opts...)

6 Likes