Predicate function operator that creates new predicate functions linked by the && operator.

Andify(...)

Arguments

...

n functions to apply in order from left to right.

Value

A predicate function linked by the && operator.

See also

Orify to create new predicate functions linked by the || operator.

Other predicate function operators: Orify

Examples

# Examples is_numeric <- is.numeric is_even <- function(x) x %% 2 == 0 greater_than_10 <- function(x) x > 10 less_than_100 <- function(x) x < 100 even_number_between_10_and_100 <- Andify(is_numeric, is_even, greater_than_10, less_than_100) even_number_between_10_and_100(8) # FALSE
#> [1] FALSE
even_number_between_10_and_100(9) # FALSE
#> [1] FALSE
even_number_between_10_and_100(10) # FALSE
#> [1] FALSE
even_number_between_10_and_100(11) # FALSE
#> [1] FALSE
even_number_between_10_and_100(12) # TRUE
#> [1] TRUE
even_number_between_10_and_100(49) # FALSE
#> [1] FALSE
even_number_between_10_and_100(50) # TRUE
#> [1] TRUE
even_number_between_10_and_100(100) # FALSE
#> [1] FALSE
even_number_between_10_and_100(101) # FALSE
#> [1] FALSE
even_number_between_10_and_100(102) # FALSE
#> [1] FALSE