represents the first argument supplied to a pure function.
represents the n argument.
represents the value associated with key "name" in an association in the first argument.
- # is used to represent arguments or formal parameters in pure functions of the form body& or Function[body].
- # is equivalent to Slot.
- #n is equivalent to Slot[n]. n must be a non‐negative 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 represents the first argument supplied to a pure function. The expression Slot 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.
Examplesopen allclose all
Basic Examples (3)
Generalizations & Extensions (1)
Properties & Relations (3)
Possible Issues (3)
Neat Examples (1)
Introduced in 1988
(1.0)| Updated in 2014