Search code examples
juliatypeof

How do I create a list in Julia?


I thought that a lst could be written as following.
But using the typeof() function one can see that its not a list.

julia> a = [1,"test", π]
       typeof(a)

Vector{Any} (alias for Array{Any, 1})

Solution

  • If you come from Python then what Python calls a list is the same as Vector{Any} in Julia in your example.

    However, if you are interested in a linked list data structure instead then you have it in DataStructures.jl package, see here.