在两个Int64的元组上使用+函数返回总和:
julia> +((1, 2))
3
Run Code Online (Sandbox Code Playgroud)
但是,在引用元组的变量上使用+函数会出现以下错误:
julia> a = (1, 2)
(1,2)
julia> +(a)
ERROR: MethodError: no method matching +(::Tuple{Int64, Int64})
Run Code Online (Sandbox Code Playgroud)
我无法理解为什么它会像这样,特别是当以下代码返回true时.
julia> typeof(a) == typeof((1, 2))
Run Code Online (Sandbox Code Playgroud)