# Why not filt, filter as filter?

**URL:** <https://discourse.julialang.org/t/why-not-filt-filter-as-filter/4442>\
**Category:** General Usage\
**Created:** [June 24, 2017, 4:25pm UTC](https://discourse.julialang.org/t/why-not-filt-filter-as-filter/4442 "2017-06-24T16:25:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hpoit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hpoit/32/245_2.png) [@hpoit](https://discourse.julialang.org/u/hpoit)\
**Post date:** [June 24, 2017, 4:25pm UTC](https://discourse.julialang.org/t/why-not-filt-filter-as-filter/4442/1 "2017-06-24T16:25:29Z")

</div>

```julia
julia> methods(filter)
# 8 methods for generic function "filter":
filter(f, a::Array{T,1} where T) in Base at array.jl:1841
filter(f, Bs::BitArray) in Base at bitarray.jl:1911
filter(f, As::AbstractArray) in Base at array.jl:1819
filter(f, d::Associative) in Base at associative.jl:312
filter(f, s::Set) in Base at set.jl:229
filter(f, s::AbstractString) in Base at strings/basic.jl:462
filter(p, x::Nullable{T}) where T in Base at nullable.jl:257
filter(flt, itr) in Base at deprecated.jl:56

julia> methods(filt)
# 2 methods for generic function "filt":
filt(b::Union{AbstractArray{T,1} where T, Number}, a::Union{AbstractArray{T,1} where T, Number}, x::AbstractArray{T,N} where N) where T in Base.DSP at dsp.jl:19
filt(b::Union{AbstractArray{T,1} where T, Number}, a::Union{AbstractArray{T,1} where T, Number}, x::AbstractArray{T,N} where N, si::AbstractArray{S,N} where N) where {T, S} in Base.DSP at dsp.jl:19

julia> 

```

Is there any particular reason why these two functions are not one?

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [June 24, 2017, 5:13pm UTC](https://discourse.julialang.org/t/why-not-filt-filter-as-filter/4442/2 "2017-06-24T17:13:37Z")

</div>

This is probably because they do very different things, so it may be confusing to overload the same function.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [June 24, 2017, 5:22pm UTC](https://discourse.julialang.org/t/why-not-filt-filter-as-filter/4442/3 "2017-06-24T17:22:11Z")

</div>

DSP does note exist in Base anymore. Edit: It does, moved out for 0.7.

---

<div class="post-metadata">

**Author:** ![hpoit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hpoit/32/245_2.png) [@hpoit](https://discourse.julialang.org/u/hpoit)\
**Post date:** [June 24, 2017, 6:14pm UTC](https://discourse.julialang.org/t/why-not-filt-filter-as-filter/4442/4 "2017-06-24T18:14:21Z")

</div>

The most [disambiguating method](https://docs.julialang.org/en/stable/manual/methods/#man-ambiguities-1) should always be defined first in the function, and because they do very different things, confusion is null?

---

<div class="post-metadata">

**Author:** ![hpoit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hpoit/32/245_2.png) [@hpoit](https://discourse.julialang.org/u/hpoit)\
**Post date:** [June 24, 2017, 6:17pm UTC](https://discourse.julialang.org/t/why-not-filt-filter-as-filter/4442/5 "2017-06-24T18:17:29Z")

</div>

Did you read that [here](https://github.com/JuliaLang/julia/blob/master/NEWS.md#julia-v060-release-notes) somewhere? I couldn’t find it.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [June 24, 2017, 6:26pm UTC](https://discourse.julialang.org/t/why-not-filt-filter-as-filter/4442/6 "2017-06-24T18:26:45Z")

</div>

[https://github.com/JuliaLang/julia/pull/21956](https://github.com/JuliaLang/julia/pull/21956)
