Skip to main content

partially_evaluate

Function partially_evaluate 

Source
pub fn partially_evaluate(
    expr: &TLExpr,
    env: &PEEnv,
    config: &PEConfig,
) -> PEResult
Expand description

Partially evaluate expr under env according to config.

Variables are zero-arity predicates. Any such predicate whose name appears in env is substituted with the bound value. Arithmetic and boolean identities are applied when both operands are known. Dead branches in logical operators are pruned when one operand resolves to a concrete boolean. Let bindings whose value reduces to a concrete constant are inlined into the body.

The returned PEResult contains:

  • The residual expression (partially reduced).
  • Accumulated statistics.
  • The names of variables still free in the output.