What’s the point of firstindex in Julia?

The first index is not necessarily 1 because Julia supports custom indexing. To understand why it is useful, you can’t beat Tim Holy’s blog post. Custom indices allow you to encode information about your data in the indexing pattern itself: sometimes it is more natural to start counting from one, sometimes from zero, sometimes from … Read more

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

Julia: append to an empty vector

Your variable x does not contain an array but a type. x = Vector{Float64} typeof(x) # DataType You can create an array as Array(Float64, n) (but beware, it is uninitialized: it contains arbitrary values) or zeros(Float64, n), where n is the desired size. Since Float64 is the default, we can leave it out. Your example … Read more

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

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