I would like to define an distributive function like this:
com[x__Plus, y_] := c @@@ Distribute[c[x, y]];
which is Ok. I know that it's possible to define it simply exploiting the fact that Plus is Flat, but consider what I wrote just as a toy model of a more refined example.
Here the point is that I cannot write
com[x__Plus, y_] := Distribute[com[x, y]];
since I would have an infinite recursion. But is there a way to obtain the result I got in the first example without using that trick, just with Hold and ReleaseHold commands?
com[x__Plus, y_] := Distribute[HoldForm[com][x, y]]the output is displayed ascom[a, c] + com[b, c], but itsFullFormisPlus[HoldForm[com][a,c],HoldForm[com][b,c]]. One can get rid of theseHoldForms (assuming that's wanted) usingReleaseHold. I think you should add theHoldFormversion as a self-answer. – Karsten7 Sep 20 '16 at 09:56