Term list transformations are used to separate, regroup and sort subpolynomial lists. These subpolynomials are transformed by separate factorizations and expansions, then recombined. Specified terms are replaced by a list of all summands of such terms. Unspecified terms are unchanged except for list order. Specified terms are added and become the new first term.
Unspecified terms are unchanged.
The termspec is 3, so the third term of the termlist is expanded. Returns termlist re-ordered so that the terms specified by termspec appear first, followed by the terms not specified. In the first example, term list elements with Head not equal to Plus are put before those with Head Plus. In the second example, terms 3 and 5 are swapped. Outputs printed list of specified terms.