Concatenating arrays in Julia

Use the vcat and hcat functions: julia> a, b = [1;2;3], [4;5;6] ([1,2,3],[4,5,6]) help?> vcat Base.vcat(A…) Concatenate along dimension 1 julia> vcat(a, b) 6-element Array{Int64,1}: 1 2 3 4 5 6 help?> hcat Base.hcat(A…) Concatenate along dimension 2 julia> hcat(a, b) 3×2 Array{Int64,2}: 1 4 2 5 3 6

None value in Julia

The Julia equivalent of None is the constant nothing: a value that is returned by expressions and functions which don’t have anything interesting to return. In both languages, this value is not printed at an interactive prompt when an expression evaluates to it, but is otherwise just a normal value. There’s nothing magical about it … Read more

How to import custom module in julia

There is a new answer to this question since the release of Julia v0.7 and v1.0 that is slightly different. I just had to do this so I figured I’d post my findings here. As already explained in other solutions, it is necessary to include the relevant script which defines the module. However, since the … Read more

Access command line arguments in Julia

Ah, more web-searching led to the right answer. The keyword ARGS::Array{ASCIIString} holds command line arguments Here is a simple example # cli.jl print(map(x->string(x, x), ARGS)) # Concatenate each arg onto itself and print Lets test it at the command line: $ julia cli.jl a b c aa bb cc

How to upgrade Julia to a new release?

2022 version Just wanted to share what I tried to update Julia on my windows and it worked just fine. I added UpdateJulia package and using that (using UpdateJulia) I updated the Julia version on my PC by update_julia(): Open Julia Package manager and type in the following commands one by one, ]add UpdateJulia using … Read more

Julia compiles the script every time?

Keno’s answer is spot on, but maybe I can give a little more detail on what’s going on and what we’re planning to do about it. Currently there is only an LLVM JIT mode: There’s a very trivial interpreter for some simple top-level statements. All other code is jitted into machine code before execution. The … Read more

Get a list of current variables in Julia Lang

An Update: whos() … is not working either in iJulia or at the command prompt in Julia-1.0.0. It is working in Julia-0.6.4, though. On the other hand, varinfo() ….prints information about the exported global variables in a module. For Example, julia-1.0> varinfo() name size summary –––––––––––––––– ––––––––––– ––––––––––––––––––––––––––––––– Base Module Core Module InteractiveUtils 154.271 KiB … Read more

In Julia, why is @printf a macro instead of a function?

Taking a variable number of arguments is not a problem for normal Julia functions [1]. @printf is a macro so that it can parse and interpret the format string at compile time and generate custom code for that specific format string. People may not realize that C’s printf function re-parses and re-interprets the format string … Read more

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