Adding an element to an array in Julia works as follows:
v = Array{Int32, 1}(0) append!(v, 1) append!(v, 2) println(v)
When I try this with a custom type
type Node label::String value::Int32 end nodes = Array{Node, 1}(0) append!(nodes, Node("a", 42))
I get the following error:
ERROR: LoadError: MethodError: no method matching length(::Node)
I assume that I need to "implement" the length method, but I donโt know how to do it.
source share