Slot


represents the first argument supplied to a pure function.


represents the ^(th) argument.


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

DetailsDetails

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

Background
Background

  • 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 ^(th) 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 body 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 ).
  • 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.
Introduced in 1988
(1.0)
| Updated in 2014
(10.0)