is a pattern object that stands for any expression that matches p, and on which the application of test gives True.
- Any result for test[pval] other than True is taken to signify failure.
- The operator ? has a high precedence. Thus _^_?t is _^(_?t), not (_^_)?t.
- In a form such as __?test, every element in the sequence matched by __ must yield True when test is applied.
- PatternTest has attribute HoldRest.
Basic Examples (3)
Find cases of any expression that satisfies the NumberQ test:
Test whether a list has only positive elements:
Create a definition that only applies to numeric arguments:
Properties & Relations (2)