I am getting a nested input dictionary as input to my code, the structure of which I’d like to preserve. It is a nested dictionary where the “end state” is always an object of the same type (which I know). See the example below.
struct examplestruct
x::Float64
y::Int64
end
D = Dict(
:child1=>Dict(
:child11=>examplestruct(0.,1),
:child12=>examplestruct(2.,5),
),
:child2=>examplestruct(-1.,10)
)
struct parentstruct
D::Dict{Symbol,Any}
end
This nested dictionary D
here is saved in another struct
, which introduces a type stability.
Does anyone have a good way around this type instability? The input will have to remain a nested structure, but I am allowed to change that structure inside my code (for computation). However, I would like to keep some form of the nested data structure, which is needed for output.