# Why does \`NTuple{N, T}\`'s parameter order is not \`{T, N}\`?

**URL:** <https://discourse.julialang.org/t/why-does-ntuple-n-t-s-parameter-order-is-not-t-n/14935>\
**Category:** General Usage\
**Tags:** tuple, syntax, design, ntuple\
**Created:** [September 14, 2018, 5:04am UTC](https://discourse.julialang.org/t/why-does-ntuple-n-t-s-parameter-order-is-not-t-n/14935 "2018-09-14T05:04:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Post date:** [September 14, 2018, 5:04am UTC](https://discourse.julialang.org/t/why-does-ntuple-n-t-s-parameter-order-is-not-t-n/14935/1 "2018-09-14T05:04:22Z")

</div>

Consider `AbstractArray{T,N}` or `Vararg{T,N}`, whose orders are both `{T, N}`. So why do `NTuple` has a different order?

---

<div class="post-metadata">

**Author:** ![Per](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/per/32/10387_2.png) [@Per](https://discourse.julialang.org/u/Per)\
**Post date:** [September 14, 2018, 5:21am UTC](https://discourse.julialang.org/t/why-does-ntuple-n-t-s-parameter-order-is-not-t-n/14935/2 "2018-09-14T05:21:06Z")

</div>

You can have both, if you do like StaticArrays and define `const TupleN{T,N} = NTuple{N,T}`.

---

<div class="post-metadata">

**Author:** ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Post date:** [September 14, 2018, 5:23am UTC](https://discourse.julialang.org/t/why-does-ntuple-n-t-s-parameter-order-is-not-t-n/14935/3 "2018-09-14T05:23:20Z")

</div>

Thanks @Per, I just want to know under what consideration made the developers choose this syntax?

---

<div class="post-metadata">

**Author:** ![Per](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/per/32/10387_2.png) [@Per](https://discourse.julialang.org/u/Per)\
**Post date:** [September 14, 2018, 5:24am UTC](https://discourse.julialang.org/t/why-does-ntuple-n-t-s-parameter-order-is-not-t-n/14935/4 "2018-09-14T05:24:38Z")

</div>

Yeah, I’m curious too. `{T,N}` feels more natural.

---

<div class="post-metadata">

**Author:** ![Keno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/keno/32/285_2.png) [@Keno](https://discourse.julialang.org/u/Keno)\
**Post date:** [September 14, 2018, 5:35am UTC](https://discourse.julialang.org/t/why-does-ntuple-n-t-s-parameter-order-is-not-t-n/14935/5 "2018-09-14T05:35:22Z")

</div>

The way to remember this is that the `N` comes first in `NTuple`. It’s just a convenience definition for `Tuple{Vararg{T, N}}`

---

<div class="post-metadata">

**Author:** ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Post date:** [September 14, 2018, 6:03am UTC](https://discourse.julialang.org/t/why-does-ntuple-n-t-s-parameter-order-is-not-t-n/14935/6 "2018-09-14T06:03:27Z")

</div>

Thank you @Keno, for me, keeping the consistent order is easier to remember.

---

<div class="post-metadata">

**Author:** ![pablosanjose](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pablosanjose/32/7006_2.png) [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Post date:** [September 14, 2018, 8:42am UTC](https://discourse.julialang.org/t/why-does-ntuple-n-t-s-parameter-order-is-not-t-n/14935/7 "2018-09-14T08:42:35Z")

</div>

I like the chosen order, because it allows me to specify only `N` (as in `f(t::NTuple{N}) where N = ...`), which for an `NTuple` I happen to need more often than the type (to know and use the number of elements statically). But as said above, this is just a convenient alias. Define another if you need it, that’s the beauty of this.
