The mutation function changes all the values in a dictionary

You are assigning the same object here to the left hand side. No copy is made implicitly. Changing b is thus reflected everywhere it is referenced.

Either assign a[i] = copy(b), or construct the dictionary like

a = Dict(i=>ones(2,2).+i for i in 1:2)
1 Like