connectives: Conjunction and disjunction

Description Usage Arguments Details Value See Also Examples

Description

conjunct and disjunct construct and return functions which represent the conjunction or disjunction of predicates.

Usage

1
2
3

Arguments

...

Predicate functions whose conjunction or disjunction to return.

where

An environment in which to resolve any character or symbol arguments.

Details

The functions passed must all take a single argument.

If some of the ... arguments are not function objects, they are resolved to function objects in the following way: character arguments are looked up in the provided where environment; symbol arguments are coerced to character and then looked up in the where environment; other types of arguments, or symbol/character arguments which fail to resolve to a function object, raise an error.

Value

A function of a single argument, representing the conjunction or disjunction of the predicates' values on its argument.

See Also

compose, which returns the composition rather than the conjunction or disjunction.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
f <- conjunct(is.positive, is.odd)
g <- conjunct(is.positive, is.zero)
h <- disjunct(is.negative, is.odd)

f(3) == TRUE
f(2) == FALSE

#false for all x - no positive numbers are 0
g(0) == FALSE
g(10) == FALSE

h(10) == FALSE
h(-10) == TRUE
h(3) == TRUE

wwbrannon/schemeR documentation built on May 4, 2019, 12:03 p.m.