# Subvalue and level

I'm interested in the arguments of f in expressions like

f[a]@f[b]@f[c]


By argument I mean what is here a, b and c. I would like to know the arguments and in what order they appear. For example, the order of the arguments in

 f[d]@(2 x f[b])@f[c]@f[q]


is

 {d, b, c, q}


How can I find this from the above expression? I tried to use Level[], but the Subvalue construction is hindering me.

-
 What would be an appropriate title for this question? – sjdh Sep 20 '12 at 12:01

Here is another way:

Cases[f[d]@(2 x f[b])@f[c]@f[q], f[x_] :> x, {-2}, Heads -> True]

-

This works:

expr = f[d]@(2 x f[b])@f[c]@f[q];
Extract[expr, Position[expr, f[_]], First]
{d, b, c, q}


Note that Extract[] and Position[] are able to handle expressions with any head, not just lists.

-