How do you feel about using Set( [(1, 2)] )?

 — John

On Sep 5, 2014, at 5:01 PM, Sam L <[email protected]> wrote:

> I can't figure out how to make a set of tuples in a very clean way. 
> 
> This works:
> 
> julia> push!(Set{(Int, Int)}(), (1,2))
> Set{(Int64,Int64)}({(1,2)})
> 
> but this doesn't:
> 
> julia> Set((1,2))
> Set{Int64}({2,1})
> 
> because that calls Set{eltype(itr)}(itr).
> 
> And this doesn't work:
> 
> julia> Set{(Int, Int)}((1,2))
> ERROR: `convert` has no method matching convert(::Type{(Int64,Int64)}, 
> ::Int64)
>  in setindex! at dict.jl:545
>  in union! at set.jl:23
>  in Set at set.jl:5
> 
> Any suggestions? 

Reply via email to