Skip to main content

evaluate

Function evaluate 

Source
pub fn evaluate<C: EvalContext>(
    arena: &ExprArena,
    id: ExprId,
    ctx: &C,
) -> Result<f64, EvalError>
Expand description

Evaluate id to an f64, pulling variable / parameter values from ctx.

The traversal is iterative and visits each reachable node once, so deep chains cannot overflow the call stack and heavily shared DAGs are evaluated in time proportional to the number of distinct nodes.

ยงErrors

Returns an EvalError if a needed variable or parameter is missing from the context.