Re: [julia-users] most generic way to request iterable type as input

2016-11-08 Thread Mauro
There is no proper way to do this. But note that your suggestion below is not any more performant than just not typing the field. You could check in the constructor whether the type can be iterated on: immutable Test{T} a::T function Test(a) @assert eltype(a)<:Integer tmp = [aa in

[julia-users] most generic way to request iterable type as input

2016-11-08 Thread Kevin Kunzmann
Hi, say I want to define a custom type with a field that accepts any kind of iterable integer type as valid input (both 1:3 as well as collect(1:3)), how would I do that in the most generic way? I know that I can use type test{T<:integer} a::Union{Range{T},Vector{T}} end But there might be