diff --git a/HISTORY.md b/HISTORY.md index 7e4fa12b639dd..1185848a2a7cd 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -340,6 +340,7 @@ New library functions * Added `Base.hasproperty` and `Base.hasfield` ([#28850]). * One argument `!=(x)`, `>(x)`, `>=(x)`, `<(x)`, `<=(x)` have been added, returning partially-applied versions of the functions, similar to the existing `==(x)` and `isequal(x)` methods ([#30915]). +* The new `map!(f, values(::AbstractDict))` method allows to modify in-place values of a dictionary ([#31223]). Standard library changes ------------------------ diff --git a/base/abstractdict.jl b/base/abstractdict.jl index 76627d4475699..514bf53b7db6f 100644 --- a/base/abstractdict.jl +++ b/base/abstractdict.jl @@ -560,6 +560,9 @@ Modifies `dict` by transforming each value from `val` to `f(val)`. Note that the type of `dict` cannot be changed: if `f(val)` is not an instance of the value type of `dict` then it will be converted to the value type if possible and otherwise raise an error. +!!! compat "Julia 1.2" + `map!(f, values(dict::AbstractDict))` requires Julia 1.2 or later. + # Examples ```jldoctest julia> d = Dict(:a => 1, :b => 2)