Skip to content

calculate_eltype(iter) produces wrong type inference #61

@dmetivie

Description

@dmetivie

I am trying to use this package to sample from Combinatorics.jl objects (which typically produce super large iterator you don't want to collect, thus your package is perfect!).

The following works, but the result is a Vector{Any} instead of Vector{Vector{Int64}}

X = 1:6
k = 2
iter = multiset_combinations(X, k)
itsample(iter, 2; replace = false, ordered = false)

if we do

itsample(iter, 20; replace = false, ordered = false) # ask for more element than the 15 in the iter

it errors ERROR: TypeError: in typeassert, expected Vector{Any}, got a value of type Vector{Vector{Int64}}

I believe this is due to usage of calculate_eltype(iter) i.e. Base.@default_eltype(iter).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions