Suppose I have a dictionary d = Dict("a"=->(1,2,3))
and I want to add an element with key "b"
to the dictionary. The following works:
merge!(d,Dict("b"=>(4,5,6)))
However, this only seems to work if the value of the key has the same “type”. In other words, the following fails:
merge!(d, Dict("b"=>(7,9)))
because the value tuple has 2 elements instead of 3.
On the other hand, creating both elements at the same time works:
d = Dict("a"=>(1,2,3), "b"=>(7,9))
Question: is there/what is a more flexible method to add elements to a dictionary than the merge!
method?