I have a doubt regarding function with variable number of arguments.
Let's consider the following case:
a = {{1, 2}, {2, 3}};
b = {{1, 3}, {3, 3}, {4, 1}};
function[x__] := x//Intersection
function[a[[;;,1]], b[[;;,1]]]
In this case everything works nicely, but if I want to select the first column of the data within the function itself mathematica returns an error:
a = {{1, 2}, {2, 3}};
b = {{1, 3}, {3, 3}, {4, 1}};
function[x__] := x[[;;,1]]//Intersection
function[a, b]
Part::pkspec1: The expression {{1,3},{3,3},{4,1}} cannot be used as a part specification.
Part::pkspec1: The expression {{1,2},{2,3}} cannot be used as a part specification.
However, if I apply the function to just one variable it works ok:
function[a]
{1,2}
What am I missing? Why I can't select parts of the variable if I have more than one variable? And which is the correct way of doing it?
Thanks!