3
튜플 배열을 갖고 싶습니다. 그러나 그것은 그것에 튜플을 추가 할 수없는 것 같습니다. 다음은 오류를 발생시키는 최소한의 코드 예제입니다.줄리아 : 배열에 튜플을 추가 할 수 없습니다.
julia> a = [(1,1),(2,2)]
2-element Array{Tuple{Int64,Int64},1}:
(1, 1)
(2, 2)
julia> append!(a, (3,3))
ERROR: MethodError: Cannot `convert` an object of type Int64 to an object of type Tuple{Int64,Int64}
This may have arisen from a call to the constructor Tuple{Int64,Int64}(...),
since type constructors fall back to convert methods.
Stacktrace:
[1] _append!(::Array{Tuple{Int64,Int64},1}, ::Base.HasLength, ::Tuple{Int64,Int64}) at ./array.jl:644
[2] append!(::Array{Tuple{Int64,Int64},1}, ::Tuple{Int64,Int64}) at ./array.jl:637
구문에 문제가 있습니까? 왜 숫자가 터플로 변환되어야하는지 불평하지 않습니다. 뭐라 구요?
OMG! 정말 고맙습니다. 나는 미쳐 가고 있었다. – tst