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

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

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

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

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

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

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

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

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

reduce(intersect, [["a", "b", "c"], ["b", "c", "d"], ["c", "d", "e"]])
1 Like

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