Open sgalal opened 6 years ago
Hi! I am using the groupby function and I notice that the return type is Dict instead of Array.
groupby
Dict
Array
https://github.com/MikeInnes/Lazy.jl/blob/432473450db3558c6ca63df718b1c2525c29595b/src/collections.jl#L44-L52
julia> groupby(x -> x[1], [(1,2,3), (2,2,3), (1,2,4), (2,3,4)]) Dict{Any,Any} with 2 entries: 2 => Any[(2, 2, 3), (2, 3, 4)] 1 => Any[(1, 2, 3), (1, 2, 4)]
Would it be better if the function returns an Array so the original order could be preserved? Like this:
julia> groupby(x -> x[1], [(1,2,3), (2,2,3), (1,2,4), (2,3,4)]) 2-element Array{Any,1}: Any[(1, 2, 3), (1, 2, 4)] Any[(2, 2, 3), (2, 3, 4)]
Besides, in Haskell, the type signature of groupBy looks like:
groupBy
groupBy :: (a -> a -> Bool) -> [a] -> [[a]]
which returns an Array.
Hi! I am using the
groupby
function and I notice that the return type isDict
instead ofArray
.https://github.com/MikeInnes/Lazy.jl/blob/432473450db3558c6ca63df718b1c2525c29595b/src/collections.jl#L44-L52
Would it be better if the function returns an
Array
so the original order could be preserved? Like this:Besides, in Haskell, the type signature of
groupBy
looks like:which returns an
Array
.