I have defined my own algebra using the unused operators $\oplus$ and $\otimes$. During evaluation, lists pop up which have the structure
{a__,{b_\[CirclePlus]c_},d__}
which I would like to expand to
{a__,b_,d__}\[CirclePlus]{a__,c_,d__}
I tried
{a_, {b_\[CirclePlus]c_}, d_} := {a, b, d}\[CirclePlus]{a, c, d}
but this returns the error
SetDelayed::shape: Lists {a__,{b_\[CirclePlus]c_},d__} and {a,b,d}\[CirclePlus]{a,c,d} are not the same shape.
How can I define such an expansion rule?
List
. It will work with most other heads, e.g.,list[a_, list[b_\[CirclePlus]c_], d_] := list[a, b, d]\[CirclePlus]list[a, c, d]
is fine... $\endgroup$