How do I combine tuples?

julia> AT = ((1,2), (2,3))
((1, 2), (2, 3))

julia> ct = (3,4)
(3, 4)
julia> (AT, ct)
(((1, 2), (2, 3)), (3, 4))

julia> (AT; ct)
(3, 4)

Is there a way to get
((1, 2), (2, 3), (3, 4))

1 Like

The splat operator ... is your friend here:

julia> AT = ((1,2), (2,3));
julia> ct = (3,4)

julia> (AT..., ct)
((1, 2), (2, 3), (3, 4))

You can think of splatting as ‘unpacking’ a tuple. It is usually used in function definitionss for varargs (https://docs.julialang.org/en/v1/manual/faq/#The-two-uses-of-the-…-operator:-slurping-and-splatting-1)

3 Likes