Learn R Programming

mlr3misc (version 0.15.0)

compose: 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(...)

Value

(function()) which calls the functions provided via ...

in reverse order.

Arguments

...

(functions)
Functions to compose.

Examples

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

Run the code above in your browser using DataLab