body& or Function[body] is a pure (or "anonymous") function. The formal parameters are # (or #1), #2, etc. x|->body or x function body or Function[x, body] is a pure function with a single formal parameter x. {x1, x2, ...}|->body or {x1, x2, ...} function 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.
Pure function with one parameter: In[1]:=Function[u, 3 + u][x] Out[1]=3 + x In[2]:=Function[3 + #][x] Out[2]=3 + x In[3]:=(3 + #)&[x] Out[3]=3 + x Pure function with two parameters: In[1]:=Function[{u, v}, u^2 + v^4][x, y] Out[1]=x^2 + y^4 In[2]:=(#1^2 + #2^4)&[x, y] Out[2]=x^2 + y^4 Set f to be a pure function: In[1]:=f=(3 + #)& Out[1]=3 + #1& Use the pure function: In[2]:={f[a], f[b]} Out[2]={3 + a, 3 + b}
& | |->
escape key fn escape key
Set | SetDelayed | TagSet | TagSetDelayed | TagUnset | Unset | UpSet | UpSetDelayed
⋮ expr_1/.expr_2 | ReplaceAll[expr_1, expr_2] expr_1//.expr_2 | ReplaceRepeated[expr_1, expr_2] expr_1*=expr_2 | TimesBy[expr_1, expr_2] expr_1-=expr_2 | SubtractFrom[expr_1, expr_2] expr_1+=expr_2 | AddTo[expr_1, expr_2] expr_1/=expr_2 | DivideBy[expr_1, expr_2] expr& | Function[expr] expr_1:expr_2 | Colon[expr_1, expr_2] expr_1//=expr_2 | ApplyTo[expr_1, expr_2] expr_1|expr_2 | VerticalSeparator[expr_1, expr_2] expr_1∵expr_2 | Because[expr_1, expr_2] expr_1∴expr_2 | Therefore[expr_1, expr_2] expr=. | Unset[expr] expr_1=expr_2 | Set[expr_1, expr_2] expr_1^=expr_2 | UpSet[expr_1, expr_2] expr_1:=expr_2 | SetDelayed[expr_1, expr_2] expr_1^:=expr_2 | UpSetDelayed[expr_1, expr_2] expr_1 function expr_2 | Function[{expr_1}, expr_2] symb/;expr=. | TagUnset[symb, expr] symb/:expr_1=expr_2 | TagSet[symb, expr_1, expr_2] symb/:expr_1:=expr_2 | TagSetDelayed[symb, expr_1, expr_2] expr>>filename | Put[expr, "filename"] expr>>>filename | PutAppend[expr, "filename"] expr_1;expr_2; | CompoundExpression[expr_1, expr_2, Null] expr_1;expr_2;expr_3 | CompoundExpression[expr_1, expr_2, expr_3] ⋮
(grouped in order of decreasing precedence)
HoldAll | Protected
Apply | Construct | CurryApplied | ApplyTo | CompiledFunction | InterpolatingFunction | Slot | SlotSequence | FunctionCompile | IncrementalFunction
19th most common (1 in 253 symbols)
21st most common (1 in 182 symbols)
11th most common (1 in 136 symbols)
introduced in Version 1 (June 1988) last modified in Version 12.2 (December 2020)