While playing around with the solutions to this question, I've found some very strange behaviour:
MatchQ[3,_?Composition[Not,OptionQ]]
(*
==> False
*)
MatchQ[3,_?(Not[OptionQ[#]]&)]
(*
==> True
*)
Composition[Not,OptionQ][3]
(*
==> True
*)
So what's wrong with the first pattern? Or did I just find some bug?
a?f[b] // FullFormgivesPatternTest[a,f][b], which is not something we are used to. I just happened to have been bitten by this a few times. The same story with theFunction: have to wrap it in parentheses as well. I actually mentioned that in my answer to the question you linked. – Leonid Shifrin Feb 13 '12 at 16:46Conditionfor anything that isn't completely trivial... – Brett Champion Feb 13 '12 at 16:46PatternTestin this form with parentheses quite a bit as well, but I agree that there are less chances for errors withCondition. – Leonid Shifrin Feb 13 '12 at 16:50[...]function call ... – Szabolcs Feb 13 '12 at 16:50