# Why is a union of tuples a vector?

**URL:** <https://discourse.julialang.org/t/why-is-a-union-of-tuples-a-vector/2545>\
**Category:** Internals & Design\
**Created:** [March 8, 2017, 6:10pm UTC](https://discourse.julialang.org/t/why-is-a-union-of-tuples-a-vector/2545 "2017-03-08T18:10:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [March 8, 2017, 6:10pm UTC](https://discourse.julialang.org/t/why-is-a-union-of-tuples-a-vector/2545/1 "2017-03-08T18:10:00Z")

</div>

Is there a compelling reason that

```
 # NTuple{T} means NTuple{N,T} for any appropriate Ns
 union{T}(x::NTuple{T}, y::NTuple{T})::Vector{T}
 # instead of (pretending N3 is allowed)
 union{T}(x::NTuple{T}, y::NTuple{T})::NTuple{T}

```

and similarly for intersect?

---

<div class="post-metadata">

**Author:** ![tomlee](https://avatars.discourse-cdn.com/v4/letter/t/f08c70/32.png) [@tomlee](https://discourse.julialang.org/u/tomlee)\
**Post date:** [March 14, 2017, 8:18am UTC](https://discourse.julialang.org/t/why-is-a-union-of-tuples-a-vector/2545/2 "2017-03-14T08:18:13Z")

</div>

Possibly because it would not be type stable, because you wouldn’t know ahead of time how many items will be in the returned tuple.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [March 14, 2017, 1:36pm UTC](https://discourse.julialang.org/t/why-is-a-union-of-tuples-a-vector/2545/3 "2017-03-14T13:36:53Z")

</div>

@tomlee is correct: you shouldn’t really be treating tuples as a general container like this. It’s handy to do some computations with them, but in general they belong more to the type domain than the value domain. If there is in principle, no way to predict how many values you have – as is the case for unions – then you should definitely not be using tuples.
