MapApply
f@@@expr or MapApply[f,expr]
replaces heads at level 1 of expr by f.
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 allclose allBasic Examples (4)
Scope (3)
MapApply can be used with any expression, not just lists:
Apply a function to the rows of a SparseArray object:
Use MapApply with structured arrays, such as SymmetrizedArray and QuantityArray:
Applications (2)
Properties & Relations (8)
MapApply[f,expr] is equivalent to Apply[f,expr,{1}]:
MapApply is a combination of Map and Apply:
MapApply can replace heads inside held expressions without allowing evaluation to proceed:
Use ReleaseHold to allow evaluation to proceed:
If only some arguments are held, only those arguments will not evaluate further:
Map gives each sublist as a single argument to the mapped function:
MapApply takes the elements of the sublist as separate arguments:
MapApply ignores any element of the input expression that does not itself have any subparts:
MapApply[f,expr] returns expr if the latter does not have any parts at level 1:
Compute MapApply in parallel:
f@@@list is equivalent to MapApply[f,list]:
MapApply replaces the head of each part of an expression with another expression:
ComapApply successively replaces the head of an expression with the parts of another expression:
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