Skip to content

Commit

Permalink
add compat annotations for replace on tuples (JuliaLang#41701)
Browse files Browse the repository at this point in the history
The methods were added in JuliaLang#38216.
  • Loading branch information
rfourquet committed Jul 28, 2021
1 parent 2fbeef8 commit 57ce0e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ Standard library changes
* `replace(::String)` now accepts multiple patterns, which will be applied left-to-right simultaneously,
so only one pattern will be applied to any character, and the patterns will only be applied to the input
text, not the replacements ([#40484]).
* New `replace` methods to replace elements of a `Tuple`.


#### Package Manager

Expand Down
6 changes: 6 additions & 0 deletions base/set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,9 @@ replaced.
See also [`replace!`](@ref), [`splice!`](@ref), [`delete!`](@ref), [`insert!`](@ref).
!!! compat "Julia 1.7"
Version 1.7 is required to replace elements of a `Tuple`.
# Examples
```jldoctest
julia> replace([1, 2, 1, 3], 1=>0, 2=>4, count=2)
Expand Down Expand Up @@ -596,6 +599,9 @@ Return a copy of `A` where each value `x` in `A` is replaced by `new(x)`.
If `count` is specified, then replace at most `count` values in total
(replacements being defined as `new(x) !== x`).
!!! compat "Julia 1.7"
Version 1.7 is required to replace elements of a `Tuple`.
# Examples
```jldoctest
julia> replace(x -> isodd(x) ? 2x : x, [1, 2, 3, 4])
Expand Down

0 comments on commit 57ce0e6

Please sign in to comment.