# Filter(.., ::Tuple)

**URL:** <https://discourse.julialang.org/t/filter-tuple/16108>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 10, 2018, 9:38am UTC](https://discourse.julialang.org/t/filter-tuple/16108 "2018-10-10T09:38:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [October 10, 2018, 9:38am UTC](https://discourse.julialang.org/t/filter-tuple/16108/1 "2018-10-10T09:38:43Z")

</div>

Since there is no `filter` for `Tuple`s, eg

```julia
julia> t = (1, 2, 3)
(1, 2, 3)

julia> filter(isodd, t)
ERROR: MethodError: no method matching filter(::typeof(isodd), ::Tuple{Int64,Int64,Int64})
Closest candidates are:
  filter(::Any, ::Array{T,1} where T) at array.jl:2352
  filter(::Any, ::BitArray) at bitarray.jl:1637
  filter(::Any, ::AbstractArray) at array.jl:2313
  ...
Stacktrace:
 [1] top-level scope at none:0

```

should I convert to vectors and back,

```julia
julia> tuple(filter(isodd, [t...])...)
(1, 3)

```

or is there a better option?

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [October 10, 2018, 9:42am UTC](https://discourse.julialang.org/t/filter-tuple/16108/2 "2018-10-10T09:42:35Z")

</div>

That was moved to Iterators :  
`Iterators.filter(isodd, (1,2,3))`  
It does return a new Iterator - which is likely why it doesn’t overload Base.filter directly.  
So I guess you need to do something like:

```julia
(Iterators.filter(isodd, (1,2,3))...,)

```
