Suppose I am using/importing a module in Julia:
using someModule
I didn't write the module and I would like to know what functions,variables,types, etc. are in the export line of that module. How van I do that? (I'm using Julia 1.3.1)
My guess based on reading the docs: using is used to bring another module into the name-space of the current module. import is used to bring specific types/functions/variables from other modules into the name-space of the current module.
Julia looks for module files in directories defined in the LOAD_PATH variable. And, since you don't want to do this every single time you run Julia, put this line into your startup file ~/. julia/config/startup. jl , which runs each time you start an interactive Julia session.
Julia has two mechanisms for loading code: Code inclusion: e.g. include("source. jl") . Inclusion allows you to split a single program across multiple source files.
To load a module from a package, the statement using ModuleName can be used. To load a module from a locally defined module, a dot needs to be added before the module name like using . ModuleName .
The names
function will list all names exported by the given module. For example:
julia> using Statistics
julia> names(Statistics)
14-element Array{Symbol,1}:
:Statistics
:cor
:cov
:mean
:mean!
:median
:median!
:middle
:quantile
:quantile!
:std
:stdm
:var
:varm
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