# Slot

#

represents the first argument supplied to a pure function.

#n

represents the n argument.

#name

represents the value associated with key "name" in an association in the first argument.

# Details

• # is used to represent arguments or formal parameters in pure functions of the form body& or Function[body].
• # is equivalent to Slot[1].
• #n is equivalent to Slot[n]. n must be a nonnegative integer.
• #0 gives the head of the function, i.e. the pure function itself.
• When applied to an association, #name is equivalent to #["name"] and picks out elements in the association.
• In the form #name, the characters in name can be any combination of alphanumeric characters not beginning with digits.

# Background & Context

• Slot[1] represents the first argument supplied to a pure function. The expression Slot[1] may be compactly denoted with the hash character , or more explicitly as . The argument to a pure function is represented by Slot[n], commonly denoted . The zeroth slot of a pure function is its head.
• Slot is typically used inside Function. In pure functions of the form , # is used as part of the to represent arguments or formal parameters. An example application of Slot is given by , which evaluates to .
• A sequence of arguments to be supplied to a pure function is represented using SlotSequence (written in shorthand as ##n).
• When pure functions are nested, the meaning of slots may become ambiguous, in which case parameters must be specified using an explicit Function construction with named parameters.

# Examples

open allclose all

## Basic Examples(3)

# represents the first argument of a pure function:

 In[1]:=
 Out[1]=

Use numbered arguments:

 In[1]:=
 Out[1]=

Used named arguments from an association:

 In[1]:=
 Out[1]=