# How to handle Array of Arrays?

**URL:** <https://discourse.julialang.org/t/how-to-handle-array-of-arrays/59602>\
**Category:** General Usage\
**Tags:** arrays\
**Created:** [April 19, 2021, 5:42pm UTC](https://discourse.julialang.org/t/how-to-handle-array-of-arrays/59602 "2021-04-19T17:42:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ziolai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ziolai/32/23422_2.png) [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Post date:** [April 19, 2021, 5:42pm UTC](https://discourse.julialang.org/t/how-to-handle-array-of-arrays/59602/1 "2021-04-19T17:42:29Z")

</div>

How to construct ff and gg from hh in the code below? Thx!

f(x) = [1;1]  
g(x) = x\*[1;1]  
h(x) = [1;1], x\*[1;1]  
ff = mapreduce(f,vcat, [1 2 3])  
gg = mapreduce(g,vcat, [1 2 3])  
hh = map(h, [1 2 3])

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [April 19, 2021, 6:26pm UTC](https://discourse.julialang.org/t/how-to-handle-array-of-arrays/59602/2 "2021-04-19T18:26:36Z")

</div>

this maybe:

```julia
julia> fff, ggg = vcat.(hh...)
([1, 1, 1, 1, 1, 1], [1, 1, 2, 2, 3, 3])

```

---

<div class="post-metadata">

**Author:** ![ziolai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ziolai/32/23422_2.png) [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Post date:** [April 19, 2021, 9:10pm UTC](https://discourse.julialang.org/t/how-to-handle-array-of-arrays/59602/3 "2021-04-19T21:10:23Z")

</div>

Aha! Thx! What does … following hh refer to?

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [April 19, 2021, 9:11pm UTC](https://discourse.julialang.org/t/how-to-handle-array-of-arrays/59602/4 "2021-04-19T21:11:22Z")

</div>

It’s called `splatting`. You can check out help in the Julia REPL for this via `?...`

```julia
help?> ...
search: ...

  ...

  The "splat" operator, ..., represents a sequence of arguments. ... can
  be used in function definitions, to indicate that the function accepts
  an arbitrary number of arguments. ... can also be used to apply a
  function to a sequence of arguments.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> add(xs...) = reduce(+, xs)
  add (generic function with 1 method)
  
  julia> add(1, 2, 3, 4, 5)
  15
  
  julia> add([1, 2, 3]...)
  6
  
  julia> add(7, 1:100..., 1000:1100...)
  111107

```

---

<div class="post-metadata">

**Author:** ![ziolai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ziolai/32/23422_2.png) [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Post date:** [April 19, 2021, 9:11pm UTC](https://discourse.julialang.org/t/how-to-handle-array-of-arrays/59602/5 "2021-04-19T21:11:55Z")

</div>

Right. Thx!
