Negate {functional}R Documentation

Negate a function; borrowed from src/library/base/R/funprog.R for pre-2.7 Rs.

Description

Negate a function; borrowed from src/library/base/R/funprog.R for pre-2.7 Rs.

Usage

Negate(f)

Arguments

f

the function to be negated

Value

The negated function

Examples

is.even <- function(a) a%%2 == 0
is.odd <- Negate(is.even)
stopifnot(Reduce(`&&`, Map(is.odd, c(1, 3, 5))))

[Package functional version 0.6 Index]