# Function that takes a tuple of (unknown number of) vectors of given type

**URL:** <https://discourse.julialang.org/t/function-that-takes-a-tuple-of-unknown-number-of-vectors-of-given-type/63954>\
**Category:** New to Julia\
**Created:** [July 2, 2021, 6:29pm UTC](https://discourse.julialang.org/t/function-that-takes-a-tuple-of-unknown-number-of-vectors-of-given-type/63954 "2021-07-02T18:29:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![EvoArt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evoart/32/25357_2.png) [@EvoArt](https://discourse.julialang.org/u/EvoArt)\
**Post date:** [July 2, 2021, 6:29pm UTC](https://discourse.julialang.org/t/function-that-takes-a-tuple-of-unknown-number-of-vectors-of-given-type/63954/1 "2021-07-02T18:29:56Z")

</div>

I have a function (called form within an outer function) that I want to take a tuple of vectors of n integers. n is fixed for a given run of the outer function. How would I set this up?

```julia
function inner_func1(n ::Int64)
    return Tuple([[1,2,3] for i in 1:n])
end
function inner_func2(y ::Tuple{Vector{Int64}})
    return y[end]
end
function main_func(n)
    y = inner_func1(n)
    z = inner_func2(y)
end
main_func(3)

```

gives

````julia
ERROR: MethodError: no method matching inner_func2(::Tuple{Vector{Int64}, Vector{Int64}, Vector{Int64}})
Closest candidates are:
  inner_func2(::Tuple{Vector{Int64}}) at REPL[126]:1
Stacktrace:
 [1] main_func(n::Int64)
   @ Main .\REPL[127]:3
 [2] top-level scope
   @ REPL[128]:1```
````

---

<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:** [July 2, 2021, 6:51pm UTC](https://discourse.julialang.org/t/function-that-takes-a-tuple-of-unknown-number-of-vectors-of-given-type/63954/2 "2021-07-02T18:51:18Z")

</div>

`Tuple{Vector{Int64}}` only allows for 1 entry in the tuple, you want `Tuple{Vararg{Vector{Int64}}}`.

But you probably shouldn’t be doing this many type annotations anyways. It won’t improve performance.

---

<div class="post-metadata">

**Author:** ![EvoArt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evoart/32/25357_2.png) [@EvoArt](https://discourse.julialang.org/u/EvoArt)\
**Post date:** [July 2, 2021, 7:00pm UTC](https://discourse.julialang.org/t/function-that-takes-a-tuple-of-unknown-number-of-vectors-of-given-type/63954/3 "2021-07-02T19:00:07Z")

</div>

Thank you.
