# Is there a way to make the Function construct accept a list as argument? [duplicate]

Is there a way to make the Function construct accept a list as argument ?

Writing

Function[{x,y},{x+y,x-y}]


does not work, since it accepts two arguments and not a single list.

My aim is to generate a table of functions, say

Table[Function[{x,y},{x + k y,x - k y}] , {k,1,10}]


and then to compose them in different ways. Since every such function returns a list, I would like it also to accept a list, to enable composition.

## marked as duplicate by Leonid Shifrin, m_goldberg, Michael E2, user9660, MarcoBFeb 28 '16 at 15:05

• Function[list, {list[[1]] + list[[2]], list[[1]] - list[[2]]}][{a, b}] – Quantum_Oli Feb 28 '16 at 13:21
• Also may be useful: (8382) – Mr.Wizard Feb 28 '16 at 16:14

The simple way is to write

func = Table[With[{k = k}, {#[[1]] + k #[[2]], #[[1]] - k #[[2]]} &], {k, 10}];


then

Through[func[{a, b}]]


gives

{{a + b, a - b}, {a + 2 b, a - 2 b}, {a + 3 b, a - 3 b}, {a + 4 b, a - 4 b},
{a + 5 b, a - 5 b}, {a + 6 b, a - 6 b}, {a + 7 b, a - 7 b}, {a + 8 b, a - 8 b},
{a + 9 b, a - 9 b}, {a + 10 b, a - 10 b}}