# Unpack or extract elements from array into "list" or "collection" of vectors

**URL:** <https://discourse.julialang.org/t/unpack-or-extract-elements-from-array-into-list-or-collection-of-vectors/52029>\
**Category:** New to Julia\
**Created:** [December 18, 2020, 8:52am UTC](https://discourse.julialang.org/t/unpack-or-extract-elements-from-array-into-list-or-collection-of-vectors/52029 "2020-12-18T08:52:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![b1d](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@b1d](https://discourse.julialang.org/u/b1d)\
**Post date:** [December 18, 2020, 8:52am UTC](https://discourse.julialang.org/t/unpack-or-extract-elements-from-array-into-list-or-collection-of-vectors/52029/1 "2020-12-18T08:52:04Z")

</div>

Hi there, I am not very sure about the appropriate wording. But my problem is as follows: I would like to have

```julia
intersect(["a", "b", "c"], ["b", "c", "d"], ["c", "d", "e"])

```

But I have my vectors as elements in one array, so I have more like

```julia
intersect([["a", "b", "c"], ["b", "c", "d"], ["c", "d", "e"]])

```

How could I extract the elements as input for intersect as desired above?  
Thanks

---

<div class="post-metadata">

**Author:** ![Luapulu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luapulu/32/17669_2.png) [@Luapulu](https://discourse.julialang.org/u/Luapulu)\
**Post date:** [December 18, 2020, 11:19am UTC](https://discourse.julialang.org/t/unpack-or-extract-elements-from-array-into-list-or-collection-of-vectors/52029/2 "2020-12-18T11:19:32Z")

</div>

I believe what you want is the splatting operator `...`. Try this:

```julia
intersect([["a", "b", "c"], ["b", "c", "d"], ["c", "d", "e"]]...)

```

---

<div class="post-metadata">

**Author:** ![b1d](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@b1d](https://discourse.julialang.org/u/b1d)\
**Post date:** [December 18, 2020, 12:45pm UTC](https://discourse.julialang.org/t/unpack-or-extract-elements-from-array-into-list-or-collection-of-vectors/52029/3 "2020-12-18T12:45:35Z")

</div>

Perfect!! Exactly what I was looking for. Was un-websearch-able for me, though. Thanks

---

<div class="post-metadata">

**Author:** ![Vasily\_Pisarev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vasily_pisarev/32/7929_2.png) [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Post date:** [December 18, 2020, 1:23pm UTC](https://discourse.julialang.org/t/unpack-or-extract-elements-from-array-into-list-or-collection-of-vectors/52029/4 "2020-12-18T13:23:58Z")

</div>

The splatting may be slow for large arrays, another option is

```julia
reduce(intersect, [["a", "b", "c"], ["b", "c", "d"], ["c", "d", "e"]])

```

---

<div class="post-metadata">

**Author:** ![b1d](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@b1d](https://discourse.julialang.org/u/b1d)\
**Post date:** [December 18, 2020, 1:33pm UTC](https://discourse.julialang.org/t/unpack-or-extract-elements-from-array-into-list-or-collection-of-vectors/52029/5 "2020-12-18T13:33:53Z")

</div>

Thanks, I was looking for flatten… but without success.
