pub fn apply_on_others<F: Fn(Expression) -> Expression>(self, f: F) -> Expression {
        match self {
            l @ Expression::Lit(_) => l,
            Expression::Unary(op, a) => Expression::Unary(op, Box::new(f(*a))),
            Expression::Binary(op, a, b) => {
                Expression::Binary(op, Box::new(f(*a)), Box::new(f(*b)))
            }
            Expression::Variadic(op, exprs) => {
                Expression::Variadic(op, exprs.into_iter().map(f).collect())
            }
        }
    }
//Applies function on the remaining cases of an Expression, meant to help cut down on boilerplate.
Applies function on the remaining cases of an Expression, meant to help cut down on boilerplate.
Applies function on the remaining cases of an Expression meant to help cut down on boilerplate .
pub fn apply_on_others<F: Fn(Expression) -> Expression>(self, f: F) -> Expression {
        match self {
            l @ Expression::Lit(_) => l,
            Expression::Unary(op, a) => Expression::Unary(op, Box::new(f(*a))),
            Expression::Binary(op, a, b) => {
                Expression::Binary(op, Box::new(f(*a)), Box::new(f(*b)))
            }
            Expression::Variadic(op, exprs) => {
                Expression::Variadic(op, exprs.into_iter().map(f).collect())
            }
        }
    }
pub fn apply_on_others < F : Fn ( Expression ) -> Expression > ( self , f : F ) -> Expression { match self { l @ Expression :: Lit ( _ ) => l , Expression :: Unary ( op , a ) => Expression :: Unary ( op , Box :: new ( f ( * a ) ) ) , Expression :: Binary ( op , a , b ) => { Expression :: Binary ( op , Box :: new ( f ( * a ) ) , Box :: new ( f ( * b ) ) ) } Expression :: Variadic ( op , exprs ) => { Expression :: Variadic ( op , exprs . into_iter ( ) . map ( f ) . collect ( ) ) } } }
Applies function on the remaining cases of an Expression, meant to help cut down on boilerplate.
Applies function on the remaining cases of an Expression meant to help cut down on boilerplate .
self
f
F
self
f
F