# Table of references [duplicate]

I have a list of variables (say a, b, c, d, e) that I want to assign in a single command.

{a,b,c,d,e} = {1,2,3,4,5}


would work, but it is cumbersome to type {a,b,c,d,e} each time. Is there a way I can create a table that holds references to these variables, and whenever I assign to this table, the actual variables a,b,c,d,e will get assigned?

Sorry for the question - I am new to Mathematica and do not even know the basic terms. If you guessed I have a C++ background, you are right.

• Is something like that ok: list := {a, b, c, d, e}; Unevaluated[list = {1, 2, 3, 4, 5}] /. OwnValues[list]? – Kuba Jan 30 '15 at 9:40
• related: 40094 – Kuba Jan 30 '15 at 9:46
• less related: 70250 – Kuba Jan 30 '15 at 9:54
• Proposed duplicate: (10322). Also related: (6511) (and see links below that one) – Mr.Wizard Jan 30 '15 at 10:16
• The functional programmer might wonder, why would you want to do that ? ;) – image_doctor Jan 30 '15 at 10:24

Most user friendly approach, with function:

mySet[l_] := {a, b, c, d, e} = l


I'm not sure what is the general goal, but here's one way with UpValues:

table /: Set[table, l_] := ({a, b, c, d, e} = l);

table = Range[6, 10];
{a, b, c, d, e}

{6, 7, 8, 9, 10}

table = Range[1, 5];
{a, b, c, d, e}

{1, 2, 3, 4, 5}


Different approach:

list := {a, b, c, d, e};
Unevaluated[list = {1, 2, 3, 4, 5}] /. OwnValues[list]