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 /

Position

FilledSmallSquare Position[expr, pattern] gives a list of the positions at which objects matching pattern appear in expr.
FilledSmallSquare Position[expr, pattern, levspec] finds only objects that appear on levels specified by levspec.
FilledSmallSquare Position[expr, pattern, levspec, n] gives the positions of the first n objects found.

FilledSmallSquare Example: Position[1+x^2, 5, x^4, x^_]LongRightArrow.
FilledSmallSquare Position[expr, pattern] tests all the subparts of expr in turn to try and find ones that match pattern.
FilledSmallSquare Position returns a list of positions in a form suitable for use in Extract and ReplacePart. The form is different from the one used in Part.
FilledSmallSquare The default level specification for Position is {0, Infinity}, with Heads -> True.
FilledSmallSquare A part specification {} returned by Position represents the whole of expr.
FilledSmallSquare Level specifications are described in Section A.3.6.
FilledSmallSquare See The Mathematica Book on the web: Section 1.8.5, Section 2.1.7, Section 2.2.4 and Section 2.3.2.
FilledSmallSquare See also: Cases, Count, Ordering, ReplaceList, Insert, Delete.