I have two questions. Let's think the following expression.
expr = {plus, {minus, 2, 3}, {times, 1, 2}}
Q1
I want to get something like at once
INPUT:
AllHeadPositions[expr]
OUTPUT:
expr->{{1}}
minus->{{2,1}}
times->{{3,1}}
and
Q2(MAIN)
want to get elements at one list something like
INPUT
expr[[{something to specifiy minus}]]
OUTPUT
{minus,2,3}
For 1st question,I have found the way
If[Not[NumberQ[#]], {#, Position[expr, #]}, Nothing] & /@
Flatten[expr]
but what to do for the second one?