JuliaCollections/Iterators.jl

groupby and zip iterators (julia 0.4.5)

Closed this issue · 2 comments

yjk21 commented

I am getting the following error

ERROR: LoadError: MethodError: `convert` has no method matching convert(::Type{Base.Zip2{Array{Int64,1},Array{Int64,1}}}, ::Array{Tuple{Int64,Int64},1})

when I am trying to use map on a groupby iterator based on a zip iterator:

import Iterators
srand(10)
ids = [1,1,1,1,2,2,2,3,3]
cnts = rand(1:10, length(a))

xs = zip(ids, cnts)

iter = Iterators.groupby(x->x[1], xs)
#neither of the following statements works
@show collect(iter)
@show map(x->x, iter)

This is something to do with iterator traits and I'm not sure what. Will investigate.

Fixed in #74