Construct NamedTuple dynamically

Answering my own question. I should have read this post first.

The solution:

julia> using NamedTupleTools

julia> nt = namedtuple(Symbol.(["a", "b", "c"])...)
NamedTuple{(:a, :b, :c),T} where T<:Tuple

julia> nt.([1, 2.0, "hello world"]...)
(a = 1, b = 2.0, c = "hello world")
1 Like