Function lamcal::var[][src]

pub fn var(
    name: impl Into<String>
) -> Term

Constructs a variable of the given name.

This is a convenience function for constructing a Term of variant Term::Var in a readable form with minimal keystrokes. It takes any value that can be converted into a String and returns Term::Var(VarName(name)).

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

Examples

let variable = var("x");

assert_eq!(variable, Term::Var(VarName("x".to_string())));