# Concatenating N vectors

**URL:** <https://discourse.mc-stan.org/t/concatenating-n-vectors/23433>\
**Category:** General\
**Created:** [July 13, 2021, 3:33pm UTC](https://discourse.mc-stan.org/t/concatenating-n-vectors/23433 "2021-07-13T15:33:14Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![Funko\_Unko](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/funko_unko/32/10786_2.png) [@Funko\_Unko](https://discourse.mc-stan.org/u/Funko_Unko)\
**Post date:** [July 20, 2021, 9:49pm UTC](https://discourse.mc-stan.org/t/concatenating-n-vectors/23433/21 "2021-07-20T21:49:34Z")

</div>

How come that dims(.) yields an array of length 3, and why does my code even compile? Isn’t this a bug?

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [July 21, 2021, 2:58am UTC](https://discourse.mc-stan.org/t/concatenating-n-vectors/23433/22 "2021-07-21T02:58:51Z")

</div>

I believe `dims` is treating the `vector` input like a matrix, so the returned dims array represents:

1. Array length
2. Number of rows
3. Number of cols

The lack of compiler error is a longstanding issue where the compiler allows assigning vectors of different lengths: [Assignment to vector of different size currently allowed · Issue #523 · stan-dev/stanc3 · GitHub](https://github.com/stan-dev/stanc3/issues/523)

[Previous page](https://discourse.mc-stan.org/t/concatenating-n-vectors/23433.md?page=1)
