Also helpful is
https://groups.google.com/forum/#!topic/julia-users/0cvVuOmcFpw
and a clean initialization appears to be:
latlon = Set(Array(Tuple{Float64,Float64},0))
push!(latlon, (68.0, 14.5)) ; in((59.0, 10.5), latlon) -> false
push!(latlon, (59.0, 10.5)) ; in((59.0, 10.5), latlon) -> true
On Saturday, September 6, 2014 at 2:08:41 AM UTC+2, Sam L wrote:
>
> Oh right, thanks! I forgot that works. I'd just used that like an hour ago
> for strings.
>
>
> On Fri, Sep 5, 2014 at 5:02 PM, John Myles White <[email protected]
> <javascript:>> wrote:
>
>> How do you feel about using Set( [(1, 2)] )?
>>
>> — John
>>
>> On Sep 5, 2014, at 5:01 PM, Sam L <[email protected] <javascript:>>
>> 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?
>>
>>
>