Legacy Documentation

Mathematica® Teacher's Edition (2002)

This is documentation for an obsolete product.
Current products and services
 Documentation /  Mathematica Teacher's Edition /  Built-in Functions /  Programming /  Pattern Matching /

PatternTest

FilledSmallSquare p?test is a pattern object that stands for any expression which matches p, and on which the application of test gives True.

FilledSmallSquare Any result for test[pval] other than True is taken to signify failure.
FilledSmallSquare Example: _?NumberQ represents a number of any type. The _ matches any expression, and ?NumberQ restricts to any expression which gives True on application of the number test NumberQ.
FilledSmallSquare The operator ? has a high precedence. Thus _^_?t is _^(_?t) not (_^_)?t.
FilledSmallSquare In a form such as __?test every element in the sequence matched by __ must yield True when test is applied.
FilledSmallSquare See The Mathematica Book on the web: Section 2.3.5.
FilledSmallSquare See also: Condition, Element.