Question: How to assign parameters to names?

Given is a list of equations where the lhs is a name and the rhs an expression (i.e. list(name=algebraic).

I want to passt that list to a procedure and then assign locally the names to the values on the rhs. Similar to passing options in Maple commands (e.g. plot option numpoints=n).

The below, the example throws an error

restart;
foo := proc(params) 
local names; 
names := lhs~(params)[]; 
#local op(names);
print([names]):
assign(params); 
print(b, c, d); end proc;

foo([b = 2, c = 3, d = 4]);
foo([b = 2, c = 3, d = 4]); #  error because the assignement was done to global names

How to fix that and/or avoid assignements to global names

Please Wait...