Higher-order functions
The best type to use for the parameter of a higher-order function is Callable
(implied by the &
sigil), a role common to all function-like objects. For an example of defining and calling a second-order function, see Functional Composition.
Convenient syntax is provided for anonymous functions, either a bare block, or a parametrized block introduced with ->
, which serves as a "lambda":
Last updated