This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Built-in Functions / Programming / Functional Programming /

MapAt

FilledSmallSquare MapAt[f, expr, n] applies f to the element at position n in expr. If n is negative, the position is counted from the end.

FilledSmallSquare MapAt[f, expr, i, j, ... ] applies f to the part of expr at position i, j, ... .

FilledSmallSquare MapAt[f, expr, , , ... , , , ... , ... ] applies f to parts of expr at several positions.

FilledSmallSquare Example: MapAt[f, a, b, c, 2] LongRightArrow.

FilledSmallSquare MapAt[f, a, b, c, d, 1, 4] LongRightArrow.

FilledSmallSquare MapAt[f, expr, i, j, ... ] or MapAt[f, expr, i, j, ... ] applies f to the part expr[[i, j, ... ]].

FilledSmallSquare MapAt[f, expr, , , ... , , , ... , ... ] applies f to parts expr[[, , ... ]], expr[[, , ... ]], ... .

FilledSmallSquare The list of positions used by MapAt is in the same form as is returned by the function Position.

FilledSmallSquare MapAt applies f repeatedly to a particular part if that part is mentioned more than once in the list of positions.

FilledSmallSquare Example: MapAt[f, a, b, c, 1, 3, 1] LongRightArrow.

FilledSmallSquare See Section 2.2.4.

FilledSmallSquare See also: ReplacePart, Delete, FlattenAt.

FilledSmallSquare New in Version 1.

Further Examples