Macro lambda_calculus::pi [−][src]
macro_rules! pi { ($i : expr, $n : expr) => { ... }; }
Expand description
A macro for obtaining a projection function (π) providing the i-th (one-indexed) element of
a lambda-encoded n-tuple.
Example
use lambda_calculus::term::*; use lambda_calculus::*; let t2 = || tuple!(1.into_church(), 2.into_church()); assert_eq!(beta(app(pi!(1, 2), t2()), NOR, 0), 1.into_church()); assert_eq!(beta(app(pi!(2, 2), t2()), NOR, 0), 2.into_church()); let t3 = || tuple!(1.into_church(), 2.into_church(), 3.into_church()); assert_eq!(beta(app(pi!(1, 3), t3()), NOR, 0), 1.into_church()); assert_eq!(beta(app(pi!(2, 3), t3()), NOR, 0), 2.into_church()); assert_eq!(beta(app(pi!(3, 3), t3()), NOR, 0), 3.into_church());