pub fn eval(expr: &Expr, env: &Env, fuel: Fuel) -> Result<(Value, Fuel), Error>Expand description
Evaluate expr against env with the given step budget.
Returns the resulting Value paired with the remaining fuel. The
returned fuel can be threaded into further evaluations.
§Errors
Returns Error::UnboundVariable if evaluation references a free
variable not bound in env, or Error::FuelExhausted if reduction
exceeds the budget.
§Examples
use lambda_cat::env::Env;
use lambda_cat::eval::{eval, Fuel};
use lambda_cat::syntax::Expr;
let id = Expr::lam("x", Expr::var("x"));
let (value, _fuel) = eval(&id, &Env::empty(), Fuel::new(100))?;
assert_eq!(format!("{value}"), "\\x. x");