I have a table form as:
table = {{a, 6}, {b, ff}, {c, 2}} I want to associate the first element of each pair from the table to the second element of the pair as in:
a=6, b=ff, c=2. I want the parameters a,b,c to be recognized throughout the program with assigned values. Doing as below, everything is perfect:
a := 6; a^2 + 5 Clear[a] Out[2] 41 But in the example below, I failed:
Clear[table, a, b, c] table = {{a, 6}, {b, ff}, {c, 2}} z = table[[1, 1]] z := table[[1, 2]] a^2 + 5 Out[4] {{a, 6}, {b, ff}, {c, 2}} Out[5] a Out[6] 5 + a^2 Why this fail?
Set @@@ {{a, 6}, {b, ff}, {c, 2}}. Nowareturns6,breturnsffand so on. Maybe if you explain why you think it should work, someone could explain why it doesn't. $\endgroup$