b1d
1
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?
Thanks
Luapulu
2
I believe what you want is the splatting operator ...
. Try this:
intersect([["a", "b", "c"], ["b", "c", "d"], ["c", "d", "e"]]...)
b1d
3
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
b1d
5
Thanks, I was looking for flatten… but without success.