I am trying to install and use the DataStructures package and it doesn't seem to be working; or I am missing something.
Pkg.init()
Pkg.status()
Pkg.add("DataStructures")
Pkg.status()
Pkg.update()
d = OrderedDict(Char,Int)
ERROR: OrderedDict not defined
What's the problem?
Assuming you didn't get any errors you didn't mention, then you installed the package. Now you have to let Julia know you want to use it:
julia> using DataStructures
julia> d = OrderedDict{Char,Int}()
DataStructures.OrderedDict{Char,Int32}()
julia> d['a'] = 9
julia> d
['a'=>9]
If you'd prefer not to clutter the scope, you could use import
instead:
julia> import DataStructures
julia> DataStructures.OrderedDict{Char, Int8}()
DataStructures.OrderedDict{Char,Int8}()
or
julia> import DataStructures: OrderedDict
instead. Reading the Modules section of the manual might be helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With