1 of 4
zorank
  • 829
  • 4
  • 14

merging two held expressions into a (held) compound expression

assume that I have

e1 = Hold[a=x+x;b=y+y+y];
e2 = Hold[c=a+a+b+b+b;c^2];

how to obtain the following?

e12 = Hold[a=x+x;b=y+y+y;c=a+a+b+b+b;c^2]

for example, something like

e1 ~Join~ e2 

does not work since it gives one "," sign in the middle. another attempt

With[{e1temp=e1, e2temp=e2}, Hold[e1temp;e2temp]]

gives nested Hold calls that at the end do not want to evaluate (and are hard to get rid off):

Hold[Hold[a=x+x;b=y+y+y];Hold[c=a+a+b+b+b;c^2]]

amazing that such a simple thing is causing me so much pain. :)

zorank
  • 829
  • 4
  • 14