Question: using name of a list in its printing

i have this:

u:=[a=x,b=w];

p:=[1=4,3=2,5=2];

How can I write a procedure which produces following:

[u(a)=x,u(b)=w],[p(1)=4,p(3)=2,p(5)=2]

Problem is extracting and then using variable name inside the printing. regards

Please Wait...