Part
Usage
• expr[[i]] or Part[expr, i] gives the i part of expr. • expr[[-i]] counts from the end. • expr[[0]] gives the head of expr. • expr[[i, j, ... ]] or Part[expr, i, j, ... ] is equivalent to expr[[i]] [[j]] ... . • expr[[ { , , ... } ]] gives a list of the parts , , ... of expr.
Notes
• You can make an assignment like t[[i]] = value to modify part of an expression. • When expr is a list, expr[[ { , , ... } ]] gives a list of parts. In general, the head of expr is applied to the list of parts. • You can get a nested list of parts from expr[[ , , ... ]]. Each part has one index from each list. • If any of the  are All, all parts at that level are kept. • expr[[All, i]] effectively gives the i column in expr. • Notice that lists are used differently in Part than in functions like Extract, MapAt and Position. • expr[[ Range[i, j] ]] can be used to extract sequences of parts. • If expr is a SparseArray object, expr[[ ... ]] gives the parts in the corresponding ordinary array. •  and  can be entered as [[ and ]] or \ [LeftDoubleBracket] and \ [RightDoubleBracket]. • New in Version 1; modified in 5. • Advanced Documentation.
|