compose: Composition of Functions

View source: R/compose.R

composeR Documentation

Composition of Functions

Description

Composes two or more functions into a single function. The returned function calls all provided functions in reverse order: The return value of the last function servers as input for the next to last function, and so on.

Usage

compose(...)

Arguments

...

(functions)
Functions to compose.

Value

(⁠function()⁠) which calls the functions provided via ... in reverse order.

Examples

f = compose(function(x) x + 1, function(x) x / 2)
f(10)

mlr-org/mlr3misc documentation built on April 28, 2024, 11 p.m.