I can do the following
Cases[Range@10, x_ /; OddQ[x]]
But why cannot I do x_?OddQ[x] instead of _?OddQ in the following?
Cases[Range@10, x_ ? OddQ[x]]
Generally speaking, I am confused with using ? and /;.
Edit
After reading the existing comments and answer, I understood now that ? needs function. However, it still confused me, when we prefer ? to /; and vice versa?
?must be followed by a function andOddQ[x]is not a function. This question feels a bit like "I can compute a sum withSum, but why can't I compute a sum withProduct?" – Szabolcs Sep 02 '20 at 08:00