I’m pretty sure the answer is that a zip type, is not an Array, BitArray or AbstractArray and that’s what my problem is.
I also read the definition for zip and it “runs multiple iterators”, also resultant type is not an array, so that takes care of why filter doesn’t work on a zipped thing directly.
which of course would make my question: how do i create an array of tuples from two arrays ?
then the obvious came to me
[ (x,y) for (x,y) in zip(a,b) ]
and I’m thinking, Shirley there’s a better way… I picked a bad week to give up nootropics.
julia> a=collect(1:5)
b5-element Array{Int64,1}:=
1
2
3
4
5
julia> b=randn(5)
5-element Array{Float64,1}:
1.622863416635525
-0.2613170739500653
-0.2399681094935552
-0.9209180059024933
-0.9645905168069914
julia> xy=zip(a,b)
Base.Iterators.Zip{Tuple{Array{Int64,1},Array{Float64,1}}}(([1, 2, 3, 4, 5], [1.62286, -0.261317, -0.239968, -0.920918, -0.964591]))
julia> filter((x,y)->x>5, xy)
ERROR: MethodError: no method matching filter(::getfield(Main, Symbol("##5#6")), ::Base.Iterators.Zip{Tuple{Array{Int64,1},Array{Float64,1}}})
Closest candidates are:
filter(::Any, ::Array{T,1} where T) at array.jl:2351
filter(::Any, ::BitArray) at bitarray.jl:1710
filter(::Any, ::AbstractArray) at array.jl:2312
...
Stacktrace:
[1] top-level scope at none:0