Function lamcal::lam[][src]

pub fn lam(
    param: impl Into<String>,
    body: Term
) -> Term

Constructs a lambda abstraction with given parameter and body.

This is a convenience function for constructing a Term of variant Term::Lam in a readable form with minimal keystrokes. It takes any value that can be converted into a String to form a bound variable (the parameter of the abstraction) and a Term for the body of the abstraction.

This function combined with the functions var and app let us construct any Term in the untyped lambda calculus.

Examples

let abstraction = lam("x", var("x"));

assert_eq!(
    abstraction,
    Term::Lam(
        VarName("x".to_string()),
        Box::new(Term::Var(VarName("x".to_string())))
    )
);