MapApply

f@@@expr or MapApply[f,expr]

replaces heads at level 1 of expr by f.

MapApply[f]

represents an operator form of MapApply that can be applied to an expression.

Details and Options

Examples

open allclose all

Basic Examples  (4)

Replace the head of each element of a list with f:

Equivalently:

Sum sublists by replacing the head of each with Plus:

Use the operator form of MapApply:

MapApply only affects the values of an association:

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:

Options  (1)

Heads  (1)

Apply inside the head as well as arguments:

Applications  (2)

Compute the angles with respect to the positive axis for a list of ordered pairs:

Display the factorization of an integer using superscripts:

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:

Wolfram Research (2022), MapApply, Wolfram Language function, https://reference.wolfram.com/language/ref/MapApply.html.

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_2024_mapapply, author="Wolfram Research", title="{MapApply}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/MapApply.html}", note=[Accessed: 18-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_mapapply, organization={Wolfram Research}, title={MapApply}, year={2022}, url={https://reference.wolfram.com/language/ref/MapApply.html}, note=[Accessed: 18-November-2024 ]}