Is this how you move stuff from place to place in everyday scientific pipelines? Or do you tend to do something else? If you do, sometimes you need to get rid of some fields in these NamedTuples. How do you do that?
I think it’s best to think of named tuples as anonymous structs. Convenient, but if you’re always returning the same objects, creating a proper structure is the next logical step. There’s nothing wrong with having lots of small structs.
As for deletion and general modification, Accessors.jl is the way to go
julia> using Accessors
julia> nt = (; x=4, y=10)
(x = 4, y = 10)
julia> nt2 = @delete nt.x
(y = 10,)
I didn’t know how to delete an entry. Thank you, @cstjean .
To select a subset:
julia> nt = (; a = "hello", b = 3.14, c = -999, d = :somesymbol)
(a = "hello", b = 3.14, c = -999, d = :somesymbol)
julia> nt[ (:b, :c) ]
(b = 3.14, c = -999)