Does a Python-like virtualenv exist in Julia?

Currently (julia 1.2) is able to manage virual environments via it’s builtin Pkg standard library module: https://docs.julialang.org/en/v1/stdlib/Pkg julia> ] (v1.2) pkg> activate tutorial [ Info: activating new environment at `/tmp/tutorial/Project.toml`. (tutorial) pkg> (tutorial) pkg> status Status `/tmp/tutorial/Project.toml` (empty environment) (tutorial) pkg> add Example … (tutorial) pkg> status Status `/tmp/tutorial/Project.toml` [7876af07] Example v0.5.1 There is Playground.jl … Read more

How does one clear or remove a global in julia?

See the latest answer to this question here: https://docs.julialang.org/en/v1/manual/faq/#How-do-I-delete-an-object-in-memory%3F Retrieved from the docs: Julia does not have an analog of MATLAB’s clear function; once a name is defined in a Julia session (technically, in module Main), it is always present. If memory usage is your concern, you can always replace objects with ones that consume … Read more

What is the difference between @code_native, @code_typed and @code_llvm in Julia?

The standard CPython implementation of Python parses source code and does some pre-processing and simplification of it – aka “lowering” – transforming it to a machine-friendly, easy-to-interpret format called “bytecode”. This is what is displayed when you “disassemble” a Python function. This code is not executable by the hardware – it is “executable” by the CPython interpreter. … Read more

How to write “good” Julia code when dealing with multiple types and arrays (multiple dispatch)

Julia compiles a specific version of your function for each set of inputs as required. Thus to answer part 1, there is no performance difference. The parametric way is the way to go. As for part 2, it might be a good idea in some cases to write a separate version (sometimes for performance reasons, e.g., to … Read more

How to make a GUI in Julia?

This is quite a generic question, but I’ll try and layout the environment so that you can make an informed decision based on your needs. You might want to check out this article on 6 Julia Frameworks to Create Desktop GUI’s 🖥 and Web Apps. If you are developing your code within an [Jupyter/IJulia] notebook, … Read more

Determine version of a specific package

EDIT: For Julia version 1.1+ Use the Pkg REPL notation: ] status # Show every installed package version ] status pkgName # Show the specific version of the package ] status pkgName1 pkgName2 # Show the named packages. You can continue the list. The ] enters the Pkg REPL, so you basically write status … … Read more

How can I dispatch on traits relating two types, where the second type that co-satisfies the trait is uniquely determined by the first?

Certainly! Here’s the complete code incorporating the approaches discussed: using Traits @traitdef IsProduct{X} begin isnew(X) -> Bool coolness(X) -> Float64 end @traitdef IsProductWithMeasurement{X,M} begin @constraints begin istrait(IsProduct{X}) end measurements(X) -> M end type Rope color::String age_in_years::Float64 strength::Float64 length::Float64 end type Paper color::String age_in_years::Int64 content::String width::Float64 height::Float64 end function isnew(x::Rope) x.age_in_years < 10.0 end function coolness(x::Rope) … Read more

Running Julia .jl files

If you want to run the julia script from a command line then just do /path/to/julia script-name.jl In the shell of your choice. If you want to run it from the julia repl then you want something like so: julia> include(“path/to/script-name.jl”) As to why your output is split like that I think we would need … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)