We deliver solutions for the AI eraâcombining symbolic computation, data-driven insights and deep technology expertise.
body& or Function[body]
is a pure (or "anonymous") function. The formal parameters are # (or #1), #2, etc.
x|->body or xbody or Function[x,body]
is a pure function with a single formal parameter x.
{x1,x2,…}|->body or {x1,x2,…}body or Function[{x1,x2,…},body]
is a pure function with a list of formal parameters.
Function[params,body,attrs]
is a pure function that is treated as having attributes attrs for purposes of evaluation.
DetailsPure function with one parameter:
Pure function with two parameters:
Pick out named arguments from an association:
Scope (15) Use a Pure Function as an Argument (5)Map a pure function over a list:
Use a pure function as a predicate:
Create an array from a pure function:
Sort by comparing the second part of each element:
Use a Pure Function as an Option Value (3)Specify a custom comparison function in FixedPoint:
Specify a custom color function:
Provide a custom distance function:
Return a Pure Function as a Result (4)Derivative of a pure function:
Derivative of Tan:
Solutions of differential equations may be expressed as pure functions:
Difference equations may return pure functions:
Function and Associations (3)#name is effectively a short form of #["name"]:
#name always refers to the association in the first argument:
Extract from an association slot other than the first:
Generalizations & Extensions (4)## n stands for arguments n and onward:
Create a pure function with attribute Listable:
#0 stands for the whole pure function:
A recursive definition for factorial using #0:
Applications (3)Turn a function that takes several arguments into one that takes a list of arguments:
A function that returns a function that multiplies its argument by n:
Preserve arguments in unevaluated form:
Properties & Relations (11)#1 uses only the first argument supplied; the rest are ignored:
Not using any arguments results in a constant pure function:
Replacements can be done inside pure functions:
Formal parameters are renamed whenever there is a possibility of confusion:
The names of the parameters do not matter:
However, reusing a name introduces a new scope:
Nested functions take their arguments one at a time:
f[#]& is the same as simply f in the univariate case:
In general, f[##]& is the same as f:
Turn a formula involving a variable into a pure function:
Use a formula in Table:
Use the corresponding pure function in an equivalent Array expression:
Special-purpose function constructs include InterpolatingFunction:
Possible Issues (4)& binds more loosely than ->, so it usually needs parentheses in rules:
& binds more loosely than ?, so it usually needs parentheses in pattern tests:
Function does not evaluate its body until the function is applied:
Supplying fewer than the required number of arguments generates an error:
Neat Examples (2)Define the recursion operator of recursion theory [more info]:
Use it to define the factorial function:
Newton's formula for finding a zero of a function:
Wolfram Research (1988), Function, Wolfram Language function, https://reference.wolfram.com/language/ref/Function.html (updated 2020). TextWolfram Research (1988), Function, Wolfram Language function, https://reference.wolfram.com/language/ref/Function.html (updated 2020).
CMSWolfram Language. 1988. "Function." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/Function.html.
APAWolfram Language. (1988). Function. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Function.html
BibTeX@misc{reference.wolfram_2025_function, author="Wolfram Research", title="{Function}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/Function.html}", note=[Accessed: 12-July-2025 ]}
BibLaTeX@online{reference.wolfram_2025_function, organization={Wolfram Research}, title={Function}, year={2020}, url={https://reference.wolfram.com/language/ref/Function.html}, note=[Accessed: 12-July-2025 ]}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4