# Removing parenthesis from a list

Say I have a list

{(Row[{Subscript[x, 2]}]\[CirclePlus]1)/Subscript[x, 1],
(Row[{Subscript[x, 1], Subscript[x, 3]}]\[CirclePlus]1)/Subscript[x, 2],
(Row[{Subscript[x, 2], Subscript[x, 4]}]\[CirclePlus]1)/Subscript[x, 3],
(Row[{Subscript[x, 3]}]\[CirclePlus]1)/Subscript[x, 4],
(Row[{Subscript[y, 2]}]\[CirclePlus]1)/Subscript[x, 1],
(Subscript[x, 1]\[CirclePlus]Subscript[y, 3])/Subscript[x, 2],
(Subscript[x, 2]\[CirclePlus]Subscript[y, 4])/Subscript[x, 3],
(Subscript[y, 3]\[CirclePlus](Subscript[y, 2] + Subscript[y, 3]))/Subscript[x, 1],
(Row[{Subscript[x, 1], Subscript[y, 4]}]\[CirclePlus]
Row[{Subscript[y, 3] + Subscript[y, 4]}])/Subscript[x, 2],
((Subscript[y, 3] + Subscript[y,4])\[CirclePlus]
(Subscript[y, 2] + Subscript[y, 3] + Subscript[y, 4]))/Subscript[x, 1]}


which looks like this in standard form.

From that list I want to remove all the ( ) parenthesis, wherever they appear. I thought that the most natural approach would be to use ReplaceAll, for instance, something along this line:

list /. (___) -> ___


But this doesn't work, any ideas?

• i think you can use Flatten – Alrubaie Apr 20 at 18:59
• I believe that I've tried this already, on different levels, but it didn't work – amator2357 Apr 20 at 19:00

Sounds like you want the formatting of CirclePlus to have a lower precedence than Plus. One idea would be to modify the formatting of CirclePlus to do this:

MakeBoxes[CirclePlus[a__], form_] := RowBox @ Riffle[
"\[CirclePlus]"
]


{
(Row[{Subscript[x,2]}]⊕1)/Subscript[x,1],
(Row[{Subscript[x,1],Subscript[x,3]}]⊕1)/Subscript[x,2],
(Row[{Subscript[x,2],Subscript[x,4]}]⊕1)/Subscript[x,3],
(Row[{Subscript[x,3]}]⊕1)/Subscript[x,4],
(Row[{Subscript[y,2]}]⊕1)/Subscript[x,1],
(Subscript[x,1]⊕Subscript[y,3])/Subscript[x,2],
(Subscript[x,2]⊕Subscript[y,4])/Subscript[x,3],
(Subscript[y,3]⊕(Subscript[y,2]+Subscript[y,3]))/Subscript[x,1],
(Row[{Subscript[x,1],Subscript[y,4]}]⊕Row[{Subscript[y,3]+Subscript[y,4]}])/Subscript[x,2],
((Subscript[y,3]+Subscript[y,4])⊕(Subscript[y,2]+Subscript[y,3]+Subscript[y,4]))/Subscript[x,1]
} //TeXForm


$$\left\{\frac{x_2\oplus 1}{x_1},\frac{x_1x_3\oplus 1}{x_2},\frac{x_2x_4\oplus 1}{x_3},\frac{x_3\oplus 1}{x_4},\frac{y_2\oplus 1}{x_1},\frac{x_1\oplus y_3}{x_2},\frac{x_2\oplus y_4}{x_3},\frac{y_3\oplus y_2+y_3}{x_1},\frac{x_1y_4\oplus y_3+y_4}{x_2},\frac{y_3+y_4\oplus y_2+y_3+y_4}{x_1}\right\}$$

This is not really an answer but an attempt to get the OP to clarify his/her thinking and then to rephrase the question to express what is really in question.

You can't replace parentheses in expressions. Internally they don't exist and will never be matched. Parentheses only show up in Notebooks and scripts where binary operator symbols are used as a user input convenience. Formally, the Wolfram Language is parentheses-free. Operators are not binary but take the form OpHead[___], which allows any number of arguments.

You should study your expression as it is output by FullForm and see what the pattern matcher sees.

<your expression> // FullForm


which will give

As you can see from the above, there is not one set of parentheses to match.

• Thank you @m_goldberg ! That is actually a very useful answer, very useful thing to know. To give you some more background, the issue that I'm facing with the list above is that when I'm replacing expression involving y (using ReplaceAll), say Plus[Subscript[y, 2], Subscript[y, 3], Subscript[y, 4]], it replaces Plus[Subscript[y, 2], Subscript[y, 3]] and Subscript[y, 3] separately, in some cases, in others it doesn't, which seems really odd and I'm struggling to see why this is happening...Can you think of any possible issues? – amator2357 Apr 20 at 20:00