Collect values in a dict

Not sure if it is more “idiomatic”, but I find that get! is a very useful function for things like this:

for (x,y) in l
    v = get!(d, y) do
        Int[]
    end
    push!(v, x)
end
1 Like