While tinkering with How to get a list of monomials of a polynomial without coefficients? on a whim I tried a fourth argument in Collect
and found:
Collect[(x + y + z + 1)^2, {x, y}, foo, bar]
bar[bar[foo[1 + 2 z + z^2], y foo[2 + 2 z], y^2 foo[1]], x bar[foo[2 + 2 z], y foo[2]], x^2 bar[foo[1]]]
It seems that in addition to a third parameter that applies to coefficients the fourth parameter takes the place of Plus
to reassemble the expression. I also note that this functionality has been present since at least version 7.0.1.
Is this understanding correct?
When was this introduced and has it changed any since then?
Has this been discussed here before?
What uses might this be put to?