Function lambda_calculus::term::apply [] [src]

pub fn apply(lhs: Term, rhs: Term) -> Result<Term, Error>

Applies two terms with substitution and variable update, consuming them in the process.

Example

use lambda_calculus::term::apply;
use lambda_calculus::parser::parse;

let lhs    = parse(&"λλ42(λ13)").unwrap();
let rhs    = parse(&"λ51").unwrap();
let result = parse(&"λ3(λ61)(λ1(λ71))").unwrap();

assert_eq!(apply(lhs, rhs), Ok(result));