# Problem with cat()

**URL:** <https://discourse.julialang.org/t/problem-with-cat/15750>\
**Category:** General Usage\
**Created:** [October 1, 2018, 6:05pm UTC](https://discourse.julialang.org/t/problem-with-cat/15750 "2018-10-01T18:05:50Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Tomas\_Pevny](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomas_pevny/32/25466_2.png) [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Post date:** [October 1, 2018, 7:11pm UTC](https://discourse.julialang.org/t/problem-with-cat/15750/5 "2018-10-01T19:11:02Z")

</div>

I would like to continue on this, as I use `hcat(x...)`, where x is and array of arrays (or some other objects) quite extensively. I prefer this over `reduce(hcat,x)`, because the former is way faster.

Besides the problem judober has identified, we have just identified another one, which is if `hcat(x...)` is called many times with `x` containing different number of element, it slowly consumes all the memory of Julia (because it keeps all versions of arguments) and eventually, it fails.

My question is, what would be the ideal way implement function that takes arbitrary number of arrays and concatenate them at once. Using reduce for this is just inefficient. Should we write our function, something like  
`hhcat(Vector{T}) where {T}`?

Thanks for answers.

---

_[View the full topic](https://discourse.julialang.org/t/problem-with-cat/15750)._
