Function lambda_calculus::data::boolean::if_else
source · pub fn if_else() -> Term
Expand description
Applied to a lambda-encoded predicate and two terms it returns the first one if the predicate is true or the second one if the predicate is false.
IF_ELSE ≡ λpab.p a b ≡ λ λ λ 3 2 1
Examples
use lambda_calculus::data::boolean::{if_else, tru, fls};
use lambda_calculus::*;
assert_eq!(beta(app!(if_else(), tru(), tru(), fls()), NOR, 0), tru());
assert_eq!(beta(app!(if_else(), fls(), tru(), fls()), NOR, 0), fls());