functional (version 0.6)

Compose: Compose an arbitrary number of functions.

Description

My Happy Hacking keyboard gave out during the writing of this procedure; moment of silence, please.

Usage

Compose(...)

Arguments

...
the functions to be composed

Value

A composed function

Examples

Run this code
car <- function(list) list[[1]]
cdr <- function(list) list[2:length(list)]
cadr <- Compose(cdr, car)
stopifnot(cadr(c(1,2,3)) == 2)

Run the code above in your browser using DataLab