Splatting arrays to tuples

Hi, I want to transpile Scheme scripts into Julia. So I have to convert arrays into tuples and vice versa. Whereas the conversion of arrays into tuple works well with the splatting operator “…” (e.g.: [(:a, :b, :c)…] ==> [:a, :b, :c] ). The other way round is a bit ugly by using “tuple” (e.g.: tuple([:a, :b, :c]…) ==> (:a, :b, :c)).
I would prefer to use an expression similar to the first leaving out “tuple” (e.g.:([:a, :b, :c]…) ==> (:a, :b, :c)). But that gives an error “syntax: “…” expression outside call …”. Is it possible to modify Julia, so that one can leave out “tuple” ?
Best, Claus

Just add a trailing comma:

julia> ([3,4,5]...,)
(3, 4, 5)

Wow !!! Thanks ! Claus

This is shorter than tuple([3,4,5]…) and clear too:

1 Like