# Applying a function to a list of symbolic ratios

Say I have the following list:

{
({-Subscript[y, 2]}⊕1)/Subscript[y, 1],
({-Subscript[y, 1], -Subscript[y, 3]}⊕1)/Subscript[y, 2],
({-Subscript[y, 2]}⊕1)/Subscript[y, 3],
({Subscript[y, 2]}⊕1)/Subscript[y, 1],
(-Subscript[y, 1]⊕Subscript[y, 3])/Subscript[y, 2],
(Subscript[y, 3]⊕(Subscript[y, 2] + Subscript[y, 3]))/Subscript[y, 1]
}


Now, whenever something of the form {-a,-b,c,...} appears, I want to multiply elements of such list, from left to right, so that I'd get -a(-b)c.... As you can see, if there is a minus before every of elements that I'm multiplying, I want this minus to stay in the output, i.e. we ignore signs when multiplying. The direct sum symbol it's just a place holder, for the time being.

The following does the job:

Times @@ HoldForm /@ {-Subscript[y, 1],-Subscript[y, 3],Subscript[y, 4]}


So now, I would like to apply this to the big list at the start of the question, but I'm not sure how to do this. The only thing that would change in that list would be in the second element of that list, i.e. the first part of the numerator, the rest of the list would stay the same. Could someone help?

• Did you intend for some of the elements of the list to be lists as well? For instance, the first element of the list is ({-Subscript[y, 2]}\[CirclePlus]1)/Subscript[y, 1], which, because of the enclosing {}'s, is a list. Also, your first snippet of code doesn't evaluate correctly because there are some unmatched brackets/parentheses/curly braces. Can you please edit your post to address these issues? Otherwise, something like expr /. a : {-_, -_, __} :> (Times @@ HoldForm /@ a ) might work. – march Apr 15 at 17:14

input /. List -> (Row@*List)