MapApply 
Details and Options
- MapApply[f,expr] is equivalent to Apply[f,expr,{1}]. »
- With the option setting Heads->True, MapApply will apply inside the head of the expression in addition to its parts. »
- MapApply always effectively constructs a complete new expression and then evaluates it.
- MapApply operates on SparseArray objects and structured arrays just as it would on the corresponding ordinary lists. »
- MapApply on Association objects operates on values only. »
- MapApply[f][expr] is equivalent to MapApply[f,expr].
- Parallelize[MapApply[f,expr]] computes MapApply[f,expr] in parallel on all subkernels. »
Examples
open all close allBasic Examples (4)
Replace the head of each element of a list with f:
MapApply[f, {{a, b}, {c, d}}]f@@@{{a, b}, {c, d}}Sum sublists by replacing the head of each with Plus:
Plus@@@{{a, b, c, d}, {1, 2, 3, 4}, {e, f, 5, 6}}Use the operator form of MapApply:
MapApply[f][{{a, b}, {c}, {d, e}}]MapApply only affects the values of an association:
MapApply[f, <|{1, 2} -> {a}, {3, 4} -> {c, d, e}|>]Scope (3)
MapApply can be used with any expression, not just lists:
f@@@g[{1, 2}, {3, 4}]Apply a function to the rows of a SparseArray object:
SparseArray[{{1, 1} -> 1, {1, 2} -> 2, {5, 2} -> 3}]MapApply[f, %]Use MapApply with structured arrays, such as SymmetrizedArray and QuantityArray:
SymmetrizedArray[{{1, 2} -> 1, {1, 3} -> 2, {2, 3} -> 3}, {3, 3}, Antisymmetric[All]]f@@@%QuantityArray[{{1, 2}, {3, 4}, {5, 6}}, "Meters"]g@@@%Options (1)
Applications (2)
Compute the angles with respect to the positive
axis for a list of ordered pairs:
ArcTan@@@{{1, 1}, {-1, 1}, {-1, -1}, {1, -1}}Display the factorization of an integer using superscripts:
FactorInteger[20!]CenterDot@@MapApply[Superscript, %]Properties & Relations (8)
MapApply[f,expr] is equivalent to Apply[f,expr,{1}]:
f@@@{{a, b}, {c, d}} === Apply[f, {{a, b}, {c, d}}, {1}]MapApply is a combination of Map and Apply:
MapApply[f, {{a, b}, {c, d}}]Map[Apply[f], {{a, b}, {c, d}}]MapApply can replace heads inside held expressions without allowing evaluation to proceed:
Plus@@@Hold[{1, 2}, {3, 4}]Use ReleaseHold to allow evaluation to proceed:
ReleaseHold[{%}]If only some arguments are held, only those arguments will not evaluate further:
SetAttributes[h, HoldRest]Plus@@@h[{1, 2}, {3, 4}]Map gives each sublist as a single argument to the mapped function:
f /@ {{a, b, c}, {1, 2, 3}}MapApply takes the elements of the sublist as separate arguments:
f@@@{{a, b, c}, {1, 2, 3}}MapApply ignores any element of the input expression that does not itself have any subparts:
MapApply[f, {a, 1, "string", {b, 2}, {"s", "t"}}]MapApply[f,expr] returns expr if the latter does not have any parts at level 1:
f@@@xCompute MapApply in parallel:
Parallelize[MapApply[f, {{a, b, c}, {u, v, w}, {x, y}}]]f@@@list is equivalent to MapApply[f,list]:
Parallelize[f@@@{{a, b, c}, {u, v, w}, {x, y}}]MapApply replaces the head of each part of an expression with another expression:
MapApply[f, {head[x, y], head[a, b], immaterial[1, 2]}]ComapApply successively replaces the head of an expression with the parts of another expression:
ComapApply[{f, g, h}, head[x, y]]History
Text
Wolfram Research (2022), MapApply, Wolfram Language function, https://reference.wolfram.com/language/ref/MapApply.html.
CMS
Wolfram Language. 2022. "MapApply." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MapApply.html.
APA
Wolfram Language. (2022). MapApply. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MapApply.html
BibTeX
@misc{reference.wolfram_2026_mapapply, author="Wolfram Research", title="{MapApply}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/MapApply.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_mapapply, organization={Wolfram Research}, title={MapApply}, year={2022}, url={https://reference.wolfram.com/language/ref/MapApply.html}, note=[Accessed: 12-June-2026]}