The following shorter function definition gives the error but the longer definition doesn’t:
julia> append(a::Vector{T}, b::Vector{T})::Vector{T} where T = vcat(a, b)
ERROR: UndefVarError: `T` not defined in `Main`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
[1] top-level scope
@ REPL[1]:1
julia> function append(a::Vector{T}, b::Vector{T})::Vector{T} where T
vcat(a, b)
end
append (generic function with 1 method)
I’m not sure why the former gives the error. Could someone please tell me why this is happening?