I read the doc about Position built-in function:
"Position[expr, pattern] gives a list of the positions at which objects matching pattern appear in expr."
For instance:
Position[{"a", "b", "A", "a", "B", "c", "b"}, "b"]
returns
{{2}, {7}}
However, I am desperately looking for a built-in function that works with a test instead of a pattern matching. To be clear I would like a built-in function that behaves as follow:
(* does not work, for illustration purpose *)
Position[{"a", "b", "A", "a", "B", "c", "b"},UpperCaseQ]
would return:
{{3}, {5}}
I am aware of the Select function,
Select[{"a", "b", "A", "a", "B", "c", "b"}, UpperCaseQ]
but it returns values and not positions (and I want positions!):
{"A", "B"}
Question: Do I miss read the doc, maybe such built-in function exist?
Position[{0.,-1,5,-5.3},_?Negative]. That is probably just relevant for those cases where your entries do not all have the same head but I often use it without checking for the head, the typical test function would return false for non-matching entries anyway, cf.:OddQ["a"]– Albert Retey Nov 20 '17 at 21:35