Function lambda_calculus::data::option::unwrap_or
source · pub fn unwrap_or() -> Term
Expand description
Applied to one argument and a lambda-encoded option it returns the value inside the option or the first argument if the option doesn’t contain a value.
UNWRAP_OR ≡ λdm.m d I ≡ λ λ 1 2 I
Example
use lambda_calculus::data::option::{unwrap_or, none};
use lambda_calculus::*;
let some_one: Term = Some(1).into_church();
assert_eq!(beta(app!(unwrap_or(), 2.into_church(), some_one), NOR, 0), 1.into_church());
assert_eq!(beta(app!(unwrap_or(), 2.into_church(), none()), NOR, 0), 2.into_church());