In
Mathematica, everything is said to be an expression. As one becomes more proficient in this language, there is a natural tendency to construct expressions of ever-increasing size and complexity. Beyond that, in seeking to understand the
Mathematica constructions of others, one can easily encounter expressions that are at first sight essentially incomprehensible.
It is the purpose of this posting to propose a very simple function,
partslist, that the author has found valuable for gaining insight into the structure of seemingly bizarre expressions created by others, or even forgotten expressions created by oneself.
The definition is as follows:
cases[arg_, a_] := Cases[arg, a, {0, \}]
ngrid[arg_] := Grid[arg, Frame -> All, Alignment -> Left]
partslist[arg_] := ngrid@Reverse@Sort@(Reverse /@ Tally@(Head /@ cases[arg, _]))
The two links shown below give further details, along with an example involving an astronomy application of WolframAlpha.
https://www.dropbox.com/s/ihlumr7o5km2qy2/partslist.pdf
https://www.dropbox.com/s/43dkk41wi3hafi1/partslist.nb