pub fn app(&self, v: &Expr) -> Option<Expr> {
        match self {
            Lam(arg, body) => {
                if let Ty(a, arg_ty) = &**arg {
                    if let Pa(v0, v1) = v {
                        if let Some(v_ty) = v.ty() {
                            if &v_ty != &**arg_ty {
                                return Some(pa(app(self.clone(), (**v0).clone()),
                                               app(self.clone(), (**v1).clone())).eval());
                            }
                        }
                    };
                    let (body2, _) = body.substitute(a, v);
                    Some(body2.eval())
                } else {
                    None
                }
            }
            _ => None,
        }
    }
/// Apply value to some lambda expression.
Apply value to some lambda expression.
Apply value to some lambda expression .
pub fn app(&self, v: &Expr) -> Option<Expr> {
        match self {
            Lam(arg, body) => {
                if let Ty(a, arg_ty) = &**arg {
                    if let Pa(v0, v1) = v {
                        if let Some(v_ty) = v.ty() {
                            if &v_ty != &**arg_ty {
                                return Some(pa(app(self.clone(), (**v0).clone()),
                                               app(self.clone(), (**v1).clone())).eval());
                            }
                        }
                    };
                    let (body2, _) = body.substitute(a, v);
                    Some(body2.eval())
                } else {
                    None
                }
            }
            _ => None,
        }
    }
pub fn app ( & self , v : & Expr ) -> Option < Expr > { match self { Lam ( arg , body ) => { if let Ty ( a , arg_ty ) = & * * arg { if let Pa ( v0 , v1 ) = v { if let Some ( v_ty ) = v . ty ( ) { if & v_ty != & * * arg_ty { return Some ( pa ( app ( self . clone ( ) , ( * * v0 ) . clone ( ) ) , app ( self . clone ( ) , ( * * v1 ) . clone ( ) ) ) . eval ( ) ) ; } } } ; let ( body2 , _ ) = body . substitute ( a , v ) ; Some ( body2 . eval ( ) ) } else { None } } _ => None , } }
Apply value to some lambda expression.
Apply value to some lambda expression .
&self
v
&Expr
&self
v
&Expr