3 General cleanup

# merging Merging two held expressions into a (held)held compound expression

assume that I haveConsider

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


how toHow can I obtain the following?

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


forFor example, something like

e1 ~Join~ e2


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

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


gives nested HoldHold 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]]

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


amazingI am amazed that such a simple thing is causing me so much pain. :)

### Edit

EDIT:My current solution.

In:= e1 = Hold[a = x + x; b = y + y + y]
Out= Hold[a = x + x; b = y + y + y]

In:= e2 = Hold[c = a + a + b + b + b; c^2]
Out= Hold[c = a + a + b + b + b; c^2]

In:= merge[Hold[expr1_], Hold[expr2_]] := Hold[expr1; expr2]
In:= merge[e1, e2]

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

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


# 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. :)

EDIT:

In:= e1 = Hold[a = x + x; b = y + y + y]
Out= Hold[a = x + x; b = y + y + y]

In:= e2 = Hold[c = a + a + b + b + b; c^2]
Out= Hold[c = a + a + b + b + b; c^2]

In:= merge[Hold[expr1_], Hold[expr2_]] := Hold[expr1; expr2]
In:= merge[e1, e2]

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


# Merging two held expressions into a held compound expression

Consider

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


How can I obtain the following?

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


For example,

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]]]


I am amazed that such a simple thing is causing me so much pain. :)

### Edit

My current solution.

merge[Hold[expr1_], Hold[expr2_]] := Hold[expr1; expr2]
merge[e1, e2]

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

2 added 393 characters in body

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. :)

EDIT:

In:= e1 = Hold[a = x + x; b = y + y + y]
Out= Hold[a = x + x; b = y + y + y]

In:= e2 = Hold[c = a + a + b + b + b; c^2]
Out= Hold[c = a + a + b + b + b; c^2]

In:= merge[Hold[expr1_], Hold[expr2_]] := Hold[expr1; expr2]
In:= merge[e1, e2]

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


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. :)

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. :)

EDIT:

In:= e1 = Hold[a = x + x; b = y + y + y]
Out= Hold[a = x + x; b = y + y + y]

In:= e2 = Hold[c = a + a + b + b + b; c^2]
Out= Hold[c = a + a + b + b + b; c^2]

In:= merge[Hold[expr1_], Hold[expr2_]] := Hold[expr1; expr2]
In:= merge[e1, e2]

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

1

# 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. :)