Parts of Expressions

Mathematica's unified symbolic architecture allows immediate generalization of part-oriented list operations to arbitrary expressions—supporting operations both on individual parts, and on collections of parts at specified levels in expression trees.


Part (..[[..]]) get any part of an expression (reset with )

Length ▪ First ▪ Last ▪ Most ▪ Rest ▪ Take ▪ Drop ▪ Extract

ReplacePart replace numbered parts of an expression

Append ▪ Prepend ▪ Insert ▪ Delete ▪ DeleteCases

Position find the positions of any pattern in an expression

Cases find cases of any pattern in an expression

MapAt apply a function at particular positions in an expression

Map (/@) — apply a function at specified levels in an expression

MapAll (//@) — apply a function to all parts of an expression

Heads option for specifying whether to include heads

Sow, Reap collect parts "sown" inside of an expression

New to Mathematica? Find your learning path »
Have a question? Ask support »