Hi,
What methods should i be implementing if i am to use prepend! on a user defined datatype? Can you show me an example?
Thanks
julia> struct R
x::Int
end
julia> function f(r::R)
linearized = R[]
prepend!(linearized,r)
linearized
end
f (generic function with 1 method)
julia> f(R(3))
ERROR: MethodError: no method matching length(::R)
Closest candidates are:
length(::SimpleVector) at essentials.jl:256
length(::Base.MethodList) at reflection.jl:558
length(::MethodTable) at reflection.jl:634
...
Stacktrace:
[1] _prepend!(::Array{R,1}, ::Base.HasLength, ::R) at ./array.jl:722
[2] f(::R) at ./REPL[7]:3