Learn R Programming

functools (version 0.2.0)

Compose: Compose multiple functions.

Description

In infix and prefix forms.

Usage

Compose(...)
.f %O% .g

Arguments

...
n functions to apply in order from right to left.
.f
A function.
.g
A function.

Value

A function that will apply each function in order from right to left.

See Also

Other function operators: Fail_With; Memoise; Partial; Reduce_Right

Examples

Run this code
not_null <- `!` %O% is.null
not_null(4)
not_null(NULL)

add1 <- function(x) x + 1
Compose(add1,add1)(8)

Run the code above in your browser using DataLab