functor: Returns functor for 'map'-like applying

Description Usage Arguments Value Examples

View source: R/functional.R

Description

Returns functor for 'map'-like applying

Usage

1
functor(init = c(0))

Arguments

init

Initial vector

Value

Functor

Examples

1
2
3
4
functor(c(1, 2, 3, 4))()
# c(1, 2, 3, 4)
functor(c(1, 2, 3, 4))(function(x) {x * 2})()
# c(2, 4, 6, 8)

perfail-stud/Rstudfile documentation built on Dec. 22, 2021, 7:43 a.m.