Skip to content

Commit

Permalink
delete replace!(pred, A, new)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet committed Jul 5, 2018
1 parent d5531c3 commit f9e7351
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions base/set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -361,27 +361,6 @@ function replace_pairs!(res, A, count::Int, old_new::Tuple{Vararg{Pair}})
_replace!(new, res, A, count)
end

"""
replace!(pred::Function, A, new; [count::Integer])
Replace all occurrences `x` in collection `A` for which `pred(x)` is true
by `new`.
# Examples
```jldoctest
julia> A = [1, 2, 3, 1];
julia> replace!(isodd, A, 0, count=2)
4-element Array{Int64,1}:
0
2
0
1
```
"""
replace!(pred::Callable, A, new; count::Integer=typemax(Int)) =
replace!(x -> ifelse(pred(x), new, x), A, count=check_count(count))

"""
replace!(new::Function, A; [count::Integer])
Expand Down

0 comments on commit f9e7351

Please sign in to comment.