Function diagm() does not work in Julia v1.0.5?

There used to be many changes before the version 1.x.y. Code that worked in versions 0.3.x is probably not going to work because of those changes.

In versions above 1 you need to first use LinearAlgebra, which is the standard library that contains that function.

julia> using LinearAlgebra

julia> v = [3,4]
2-element Vector{Int64}:
 3
 4

julia> diagm(0=>v)
2×2 Matrix{Int64}:
 3  0
 0  4