replace(kv->first(kv)<3 ? 3=>last(kv) : kv, Dict(1=>2, 3=>4))
(with Julia 1.2) I believe intuitively correct return value of the above expression must be :
3=>2
3=>4
But I get only 3=>2. It really beats me.
replace(kv->first(kv)<3 ? 3=>last(kv) : kv, Dict(1=>2, 3=>4))
(with Julia 1.2) I believe intuitively correct return value of the above expression must be :
3=>2
3=>4
But I get only 3=>2. It really beats me.
A dictionary have only one value associated with each key.
julia> Dict(3=>2, 3=>4)
Dict{Int64,Int64} with 1 entry:
3 => 4
for example.
Ninjad
julia> replace(kv->first(kv)<3 ? 5=>last(kv) : kv, Dict(1=>2, 3=>4))
Dict{Int64,Int64} with 2 entries:
3 => 4
5 => 2
Oops, shame on me. Thanks a lot!