My overall goal was to produce a list of heads used in a graphics output.
For an example I used:
rp3D = FullForm[RevolutionPlot3D[{2 + Cos[t], Sin[t]}, {t, 0, 2 Pi}]];
and then
graphicsList =
Union[Flatten[rp3D //. f_[x__] /; UnsameQ[f, List] -> {f, x}]]
Union places all of the numerical values first. All I have to do is remove those elements and my goal is achieved.
I attempted to remove the numerical values using patterns and rules and found myself in my usual state of confusion and failure.
To resolve this I simplified the problem.
fakeList = {1, 2, 3, a, b, c}
I attempted to remove the numbers using:
fakeList /. {x__?NumericQ, z__} -> {z}
{2, 3, a, b, c}
I expected it to grab the first three numbers but it only gets the first one. I was unable to decipher from the documentation whether BlankSequence is greedy (apparently not).
I was unable to produce a pattern test or condition to cause "z" to be non-numeric.
Help and explanation would be greatly appreciated.
Longest
$\endgroup$graphicsList = DeleteCases[Union[Flatten[rp3D //. f_[x__] /; UnsameQ[f, List] -> {f, x}]], _?NumericQ]
orgraphicsList = Union[Flatten[rp3D //. f_[x__] /; UnsameQ[f, List] -> {f, x}]] /. _?NumericQ :> Sequence[]
$\endgroup$