Skip to main content

substitute

Function substitute 

Source
pub fn substitute(expr: &Expr, name: &str, replacement: &Expr) -> Expr
Expand description

Apply capture-avoiding substitution: replace name with replacement in expr.

Every binding form — Lam, Let, and each Match arm — alpha-renames its binders before descending when a binder would capture a free variable of replacement. A binder that shadows name stops the substitution instead, since no free occurrence of name survives under it.