What is the relation between Array{Int64,1} and AbstractSet{Int64}?

Hi, the following is the code, which confuses me.

function myF( a::AbstractSet{Int} )
              for element in a
                   print(element)
              end
end

b = Dict( 1 => 2, 2 => 3, 3 =>4 )

myF(collect(keys(b)))

I understand that collect(keys(b)) would return an array. Based on the definition, the function myF would apply to an abstract set, right? So, why calling myF(collect(keys(b))) does not give any errors at all?

It does.

Make sure your run it from a fresh process.

1 Like