diff --git a/src/evaluator/mod.rs b/src/evaluator/mod.rs index b481f1d..cd8c3a1 100644 --- a/src/evaluator/mod.rs +++ b/src/evaluator/mod.rs @@ -1,4 +1,5 @@ pub mod beta; +pub mod nbe; pub mod strategy; pub mod substitute; @@ -51,7 +52,13 @@ impl<'a> Evaluator<'a> { let start = Instant::now(); if !self.trace && self.strategy.options.kind == strategy::StrategyKind::Normal { - let result = self.normalize(term); + // Weak-head (`lazy`) stays on the spine normalizer, which stops under + // binders; every other normal-order run normalizes through NbE. + let result = if self.strategy.options.lazy { + self.normalize_spine(term) + } else { + self.normalize_nbe(term) + }; self.stats.duration = start.elapsed(); self.stats.created_terms = self.ctx.terms.total_terms().saturating_sub(initial_terms); return result; @@ -98,7 +105,15 @@ impl<'a> Evaluator<'a> { } } - fn normalize(&mut self, mut term: TermId) -> result::Result { + fn normalize_nbe(&mut self, term: TermId) -> result::Result { + let limit = self.strategy.options.limit; + let (result, reductions) = nbe::normalize(self.ctx, term, limit)?; + self.stats.steps = reductions; + self.stats.reductions = reductions; + Ok(result) + } + + fn normalize_spine(&mut self, mut term: TermId) -> result::Result { let spine_base = self.spine.len(); loop { @@ -167,7 +182,7 @@ impl<'a> Evaluator<'a> { return Ok(term); } let lambda = *self.ctx.terms.lambdas.get(lambda_id); - let normalized_body = self.normalize(lambda.body)?; + let normalized_body = self.normalize_spine(lambda.body)?; if normalized_body == lambda.body { return Ok(term); } @@ -186,7 +201,7 @@ impl<'a> Evaluator<'a> { let Some(argument) = self.spine.pop() else { break; }; - let normalized_argument = self.normalize(argument)?; + let normalized_argument = self.normalize_spine(argument)?; let new_apply = Apply { function: term, argument: normalized_argument }; term = self.ctx.terms.add_apply(new_apply); } diff --git a/src/evaluator/nbe/domain.rs b/src/evaluator/nbe/domain.rs new file mode 100644 index 0000000..574ebd3 --- /dev/null +++ b/src/evaluator/nbe/domain.rs @@ -0,0 +1,90 @@ +use crate::{ + core::{ + TermId, TypeId, + arena::{Arena, Id}, + }, + symbol::SymbolId, +}; + +/// Binder levels at or above this encode free variables by position, so readback +/// can restore the `depth + position` index the parser assigns to them. +pub const FREE_BASE: u32 = 1 << 30; + +pub type ValueId = Id; +pub type EnvId = Id; +pub type Env = Option; + +#[derive(Clone, Copy)] +pub struct Closure { + pub body: TermId, + pub parameter: Option, + pub annotation: Option, + pub env: Env, +} + +#[derive(Clone, Copy)] +pub enum Value { + Closure(Closure), + Neutral(Neutral), + Suspended { term: TermId, env: Env }, +} + +#[derive(Clone, Copy)] +pub enum Neutral { + Var(u32), + App(ValueId, ValueId), +} + +pub struct Binding { + pub value: ValueId, + pub next: Env, + pub depth: u32, +} + +pub struct Domain { + values: Arena, + envs: Arena, +} + +impl Default for Domain { + fn default() -> Self { + Domain { values: Arena::with_capacity(64), envs: Arena::with_capacity(64) } + } +} + +impl Domain { + pub fn value(&self, id: ValueId) -> Value { + *self.values.get(id) + } + + pub fn add(&mut self, value: Value) -> ValueId { + self.values.add(value) + } + + pub fn depth(&self, env: Env) -> u32 { + match env { + Some(id) => self.envs.get(id).depth, + None => 0, + } + } + + pub fn cons(&mut self, value: ValueId, env: Env) -> Env { + let binding = Binding { value, next: env, depth: self.depth(env) + 1 }; + Some(self.envs.add(binding)) + } + + /// Resolves `index` against `env`. The caller guarantees `index < depth(env)`. + pub fn lookup(&self, env: Env, mut index: u32) -> ValueId { + let mut current = env; + while index > 0 { + current = self.binding(current).next; + index -= 1; + } + self.binding(current).value + } + + fn binding(&self, env: Env) -> &Binding { + let id = env.expect("binding within the environment depth"); + self.envs.get(id) + } +} diff --git a/src/evaluator/nbe/eval.rs b/src/evaluator/nbe/eval.rs new file mode 100644 index 0000000..a66cb91 --- /dev/null +++ b/src/evaluator/nbe/eval.rs @@ -0,0 +1,64 @@ +use crate::{ + core::{TermId, TermKind}, + result, +}; + +use super::{ + Machine, + domain::{Closure, Env, FREE_BASE, Neutral, Value, ValueId}, +}; + +impl<'a> Machine<'a> { + pub(super) fn eval(&mut self, term: TermId, env: Env) -> result::Result { + match term.kind() { + TermKind::Variable(id) => { + let index = self.ctx.terms.variables.get(id).index; + let depth = self.store.depth(env); + if index < depth { + Ok(self.store.lookup(env, index)) + } else { + let level = FREE_BASE + index - depth; + Ok(self.store.add(Value::Neutral(Neutral::Var(level)))) + } + }, + TermKind::Lambda(id) => Ok(self.store.add(Value::Closure(Closure { + body: self.ctx.terms.lambdas.get(id).body, + parameter: self.ctx.terms.parameter(id), + annotation: self.ctx.terms.annotation(id), + env, + }))), + TermKind::Apply(id) => { + let apply = *self.ctx.terms.applies.get(id); + let function = self.eval(apply.function, env)?; + let suspended = Value::Suspended { term: apply.argument, env }; + let argument = self.store.add(suspended); + self.apply(function, argument) + }, + } + } + + pub(super) fn force(&mut self, value: ValueId) -> result::Result { + let mut current = value; + loop { + match self.store.value(current) { + Value::Suspended { term, env } => current = self.eval(term, env)?, + _ => return Ok(current), + } + } + } + + fn apply(&mut self, function: ValueId, argument: ValueId) -> result::Result { + let forced = self.force(function)?; + match self.store.value(forced) { + Value::Closure(closure) => { + self.fuel.tick()?; + let extended = self.store.cons(argument, closure.env); + self.eval(closure.body, extended) + }, + _ => { + let neutral = Value::Neutral(Neutral::App(forced, argument)); + Ok(self.store.add(neutral)) + }, + } + } +} diff --git a/src/evaluator/nbe/mod.rs b/src/evaluator/nbe/mod.rs new file mode 100644 index 0000000..ac6a5bc --- /dev/null +++ b/src/evaluator/nbe/mod.rs @@ -0,0 +1,68 @@ +mod domain; +mod eval; +mod readback; + +use crate::{ + context::Context, + core::TermId, + error, + result::{self, Failed}, +}; + +use domain::{Domain, ValueId}; + +/// Normalizes `term` by evaluation: evaluate into a semantic value and read it +/// back once, instead of rebuilding the term at every beta step. Returns the +/// normal form and the number of beta steps. +pub fn normalize(ctx: &mut Context, term: TermId, limit: usize) -> result::Result<(TermId, usize)> { + let mut machine = Machine::new(ctx, limit); + + let value = match machine.eval(term, None) { + Ok(value) => value, + Err(_) => return Err(machine.report_limit()), + }; + + match machine.quote(value, 0) { + Ok(term) => Ok((term, machine.fuel.used)), + Err(_) => Err(machine.report_limit()), + } +} + +struct Machine<'a> { + ctx: &'a mut Context, + store: Domain, + fuel: Fuel, + arguments: Vec, +} + +impl<'a> Machine<'a> { + fn new(ctx: &'a mut Context, limit: usize) -> Self { + Machine { ctx, store: Domain::default(), fuel: Fuel::new(limit), arguments: Vec::new() } + } + + fn report_limit(&mut self) -> Failed { + let steps = self.fuel.used; + let text = format!("eval limit reached\n\nsteps: {steps}\nreductions: {steps}"); + self.ctx.messages.add(error!("{text}")); + Failed::Abort + } +} + +struct Fuel { + used: usize, + limit: usize, +} + +impl Fuel { + fn new(limit: usize) -> Self { + Fuel { used: 0, limit } + } + + fn tick(&mut self) -> result::Result<()> { + if self.used >= self.limit { + return Err(Failed::Abort); + } + self.used += 1; + Ok(()) + } +} diff --git a/src/evaluator/nbe/readback.rs b/src/evaluator/nbe/readback.rs new file mode 100644 index 0000000..7f69bad --- /dev/null +++ b/src/evaluator/nbe/readback.rs @@ -0,0 +1,72 @@ +use crate::{ + core::{Apply, Lambda, TermId, Variable}, + result, +}; + +use super::{ + Machine, + domain::{FREE_BASE, Neutral, Value, ValueId}, +}; + +impl<'a> Machine<'a> { + /// `level` is the number of binders read back so far. + pub(super) fn quote(&mut self, value: ValueId, level: u32) -> result::Result { + let value = self.force(value)?; + match self.store.value(value) { + Value::Closure(closure) => { + let fresh = self.store.add(Value::Neutral(Neutral::Var(level))); + let extended = self.store.cons(fresh, closure.env); + let body = self.eval(closure.body, extended)?; + let body = self.quote(body, level + 1)?; + let lambda = Lambda { body }; + let parameter = closure.parameter; + let annotation = closure.annotation; + let new_id = self.ctx.terms.add_annotated(lambda, parameter, annotation); + Ok(new_id) + }, + Value::Neutral(Neutral::Var(variable)) => Ok(self.quote_variable(variable, level)), + Value::Neutral(Neutral::App(..)) => self.quote_spine(value, level), + Value::Suspended { .. } => unreachable!("force returns an evaluated value"), + } + } + + fn quote_spine(&mut self, value: ValueId, level: u32) -> result::Result { + let base = self.arguments.len(); + + let mut current = value; + let head = loop { + match self.store.value(current) { + Value::Neutral(Neutral::App(head, argument)) => { + self.arguments.push(argument); + current = head; + }, + Value::Neutral(Neutral::Var(variable)) => break variable, + Value::Suspended { .. } => current = self.force(current)?, + Value::Closure(_) => unreachable!("a neutral spine is headed by a variable"), + } + }; + + let mut term = self.quote_variable(head, level); + while self.arguments.len() > base { + let Some(argument) = self.arguments.pop() else { + break; + }; + let normalized = self.quote(argument, level)?; + let apply = Apply { function: term, argument: normalized }; + term = self.ctx.terms.add_apply(apply); + } + Ok(term) + } + + fn quote_variable(&mut self, neutral: u32, level: u32) -> TermId { + let index = if neutral >= FREE_BASE { + level + (neutral - FREE_BASE) + } else { + let Some(index) = level.checked_sub(neutral + 1) else { + unreachable!("variable level is within the readback") + }; + index + }; + self.ctx.terms.add_variable(Variable { index }) + } +} diff --git a/tests/snapshots/01_simple__apply.snap b/tests/snapshots/01_simple__apply.snap index 5af6cc1..10cdc5a 100644 --- a/tests/snapshots/01_simple__apply.snap +++ b/tests/snapshots/01_simple__apply.snap @@ -12,5 +12,5 @@ term eval steps: 3 reduces: 3 - allocs: 2 + allocs: 0 time: [time] diff --git a/tests/snapshots/01_simple__full_normal_form_under_binder.snap b/tests/snapshots/01_simple__full_normal_form_under_binder.snap index 74f085f..53def2d 100644 --- a/tests/snapshots/01_simple__full_normal_form_under_binder.snap +++ b/tests/snapshots/01_simple__full_normal_form_under_binder.snap @@ -12,5 +12,5 @@ term eval steps: 1 reduces: 1 - allocs: 1 + allocs: 2 time: [time] diff --git a/tests/snapshots/02_booleans__and_true_false.snap b/tests/snapshots/02_booleans__and_true_false.snap index afb83cc..af9d504 100644 --- a/tests/snapshots/02_booleans__and_true_false.snap +++ b/tests/snapshots/02_booleans__and_true_false.snap @@ -12,5 +12,5 @@ term eval steps: 7 reduces: 7 - allocs: 14 + allocs: 2 time: [time] diff --git a/tests/snapshots/02_booleans__not_true.snap b/tests/snapshots/02_booleans__not_true.snap index eb30ce4..287792e 100644 --- a/tests/snapshots/02_booleans__not_true.snap +++ b/tests/snapshots/02_booleans__not_true.snap @@ -12,5 +12,5 @@ term eval steps: 6 reduces: 6 - allocs: 11 + allocs: 2 time: [time] diff --git a/tests/snapshots/02_booleans__or_false_true.snap b/tests/snapshots/02_booleans__or_false_true.snap index f0870de..84930e4 100644 --- a/tests/snapshots/02_booleans__or_false_true.snap +++ b/tests/snapshots/02_booleans__or_false_true.snap @@ -12,5 +12,5 @@ term eval steps: 7 reduces: 7 - allocs: 12 + allocs: 2 time: [time] diff --git a/tests/snapshots/02_booleans__xor.snap b/tests/snapshots/02_booleans__xor.snap index 697d1d2..4e66731 100644 --- a/tests/snapshots/02_booleans__xor.snap +++ b/tests/snapshots/02_booleans__xor.snap @@ -12,5 +12,5 @@ term eval steps: 9 reduces: 9 - allocs: 16 + allocs: 2 time: [time] diff --git a/tests/snapshots/03_church__add_two_one.snap b/tests/snapshots/03_church__add_two_one.snap index 4000796..bfae09b 100644 --- a/tests/snapshots/03_church__add_two_one.snap +++ b/tests/snapshots/03_church__add_two_one.snap @@ -12,5 +12,5 @@ term eval steps: 18 reduces: 18 - allocs: 49 + allocs: 3 time: [time] diff --git a/tests/snapshots/03_church__arithmetic.snap b/tests/snapshots/03_church__arithmetic.snap index 11a5521..78d6c80 100644 --- a/tests/snapshots/03_church__arithmetic.snap +++ b/tests/snapshots/03_church__arithmetic.snap @@ -12,5 +12,5 @@ term eval steps: 18 reduces: 18 - allocs: 66 + allocs: 6 time: [time] diff --git a/tests/snapshots/03_church__exponent.snap b/tests/snapshots/03_church__exponent.snap index 77751fa..b927365 100644 --- a/tests/snapshots/03_church__exponent.snap +++ b/tests/snapshots/03_church__exponent.snap @@ -12,5 +12,5 @@ term eval steps: 19 reduces: 19 - allocs: 48 + allocs: 7 time: [time] diff --git a/tests/snapshots/03_church__is_zero.snap b/tests/snapshots/03_church__is_zero.snap index bbc599d..1e3e5d8 100644 --- a/tests/snapshots/03_church__is_zero.snap +++ b/tests/snapshots/03_church__is_zero.snap @@ -12,5 +12,5 @@ term eval steps: 5 reduces: 5 - allocs: 5 + allocs: 2 time: [time] diff --git a/tests/snapshots/03_church__leq_false.snap b/tests/snapshots/03_church__leq_false.snap index cbc9e7d..9bcaeff 100644 --- a/tests/snapshots/03_church__leq_false.snap +++ b/tests/snapshots/03_church__leq_false.snap @@ -12,5 +12,5 @@ term eval steps: 80 reduces: 80 - allocs: 268 + allocs: 2 time: [time] diff --git a/tests/snapshots/03_church__leq_true.snap b/tests/snapshots/03_church__leq_true.snap index 2e7e7c5..47bcbb6 100644 --- a/tests/snapshots/03_church__leq_true.snap +++ b/tests/snapshots/03_church__leq_true.snap @@ -12,5 +12,5 @@ term eval steps: 86 reduces: 86 - allocs: 243 + allocs: 2 time: [time] diff --git a/tests/snapshots/03_church__list.snap b/tests/snapshots/03_church__list.snap index f6175f9..ecbb765 100644 --- a/tests/snapshots/03_church__list.snap +++ b/tests/snapshots/03_church__list.snap @@ -12,5 +12,5 @@ term eval steps: 40 reduces: 40 - allocs: 161 + allocs: 5 time: [time] diff --git a/tests/snapshots/03_church__mul_two_three.snap b/tests/snapshots/03_church__mul_two_three.snap index 340ed91..3359bba 100644 --- a/tests/snapshots/03_church__mul_two_three.snap +++ b/tests/snapshots/03_church__mul_two_three.snap @@ -12,5 +12,5 @@ term eval steps: 36 reduces: 36 - allocs: 99 + allocs: 5 time: [time] diff --git a/tests/snapshots/03_church__subtraction_positive.snap b/tests/snapshots/03_church__subtraction_positive.snap index 0cafb25..a07ff09 100644 --- a/tests/snapshots/03_church__subtraction_positive.snap +++ b/tests/snapshots/03_church__subtraction_positive.snap @@ -12,5 +12,5 @@ term eval steps: 136 reduces: 136 - allocs: 367 + allocs: 5 time: [time] diff --git a/tests/snapshots/03_church__subtraction_saturation.snap b/tests/snapshots/03_church__subtraction_saturation.snap index 9135269..dd45d7d 100644 --- a/tests/snapshots/03_church__subtraction_saturation.snap +++ b/tests/snapshots/03_church__subtraction_saturation.snap @@ -12,5 +12,5 @@ term eval steps: 103 reduces: 103 - allocs: 254 + allocs: 2 time: [time] diff --git a/tests/snapshots/03_church__succ_zero.snap b/tests/snapshots/03_church__succ_zero.snap index 20c8cb3..63ffe60 100644 --- a/tests/snapshots/03_church__succ_zero.snap +++ b/tests/snapshots/03_church__succ_zero.snap @@ -12,5 +12,5 @@ term eval steps: 5 reduces: 5 - allocs: 10 + allocs: 2 time: [time] diff --git a/tests/snapshots/04_combinators__b_combinator.snap b/tests/snapshots/04_combinators__b_combinator.snap index fafd650..acc9e1d 100644 --- a/tests/snapshots/04_combinators__b_combinator.snap +++ b/tests/snapshots/04_combinators__b_combinator.snap @@ -12,5 +12,5 @@ term eval steps: 4 reduces: 4 - allocs: 16 + allocs: 3 time: [time] diff --git a/tests/snapshots/04_combinators__c_combinator.snap b/tests/snapshots/04_combinators__c_combinator.snap index 180758a..18432a3 100644 --- a/tests/snapshots/04_combinators__c_combinator.snap +++ b/tests/snapshots/04_combinators__c_combinator.snap @@ -12,5 +12,5 @@ term eval steps: 4 reduces: 4 - allocs: 17 + allocs: 3 time: [time] diff --git a/tests/snapshots/04_combinators__kleene_pred.snap b/tests/snapshots/04_combinators__kleene_pred.snap index dd08721..318bc9a 100644 --- a/tests/snapshots/04_combinators__kleene_pred.snap +++ b/tests/snapshots/04_combinators__kleene_pred.snap @@ -12,5 +12,5 @@ term eval steps: 15 reduces: 15 - allocs: 102 + allocs: 2 time: [time] diff --git a/tests/snapshots/04_combinators__skk.snap b/tests/snapshots/04_combinators__skk.snap index 168533f..59761bc 100644 --- a/tests/snapshots/04_combinators__skk.snap +++ b/tests/snapshots/04_combinators__skk.snap @@ -12,5 +12,5 @@ term eval steps: 7 reduces: 7 - allocs: 13 + allocs: 0 time: [time] diff --git a/tests/snapshots/04_combinators__w_combinator.snap b/tests/snapshots/04_combinators__w_combinator.snap index a9d8a81..2c61a8f 100644 --- a/tests/snapshots/04_combinators__w_combinator.snap +++ b/tests/snapshots/04_combinators__w_combinator.snap @@ -12,5 +12,5 @@ term eval steps: 3 reduces: 3 - allocs: 9 + allocs: 2 time: [time] diff --git a/tests/snapshots/05_scopes_and_captures__barendregt_deep_shift.snap b/tests/snapshots/05_scopes_and_captures__barendregt_deep_shift.snap index 4711919..781cdb3 100644 --- a/tests/snapshots/05_scopes_and_captures__barendregt_deep_shift.snap +++ b/tests/snapshots/05_scopes_and_captures__barendregt_deep_shift.snap @@ -12,5 +12,5 @@ term eval steps: 4 reduces: 4 - allocs: 9 + allocs: 0 time: [time] diff --git a/tests/snapshots/05_scopes_and_captures__deep_scope_shadowing.snap b/tests/snapshots/05_scopes_and_captures__deep_scope_shadowing.snap index e06dc42..1ca32bc 100644 --- a/tests/snapshots/05_scopes_and_captures__deep_scope_shadowing.snap +++ b/tests/snapshots/05_scopes_and_captures__deep_scope_shadowing.snap @@ -12,5 +12,5 @@ term eval steps: 3 reduces: 3 - allocs: 5 + allocs: 1 time: [time] diff --git a/tests/snapshots/05_scopes_and_captures__free_var_capture_avoidance.snap b/tests/snapshots/05_scopes_and_captures__free_var_capture_avoidance.snap index 5ecb516..6f5d07e 100644 --- a/tests/snapshots/05_scopes_and_captures__free_var_capture_avoidance.snap +++ b/tests/snapshots/05_scopes_and_captures__free_var_capture_avoidance.snap @@ -12,5 +12,5 @@ term eval steps: 1 reduces: 1 - allocs: 0 + allocs: 1 time: [time] diff --git a/tests/snapshots/05_scopes_and_captures__nested_capture_avoidance.snap b/tests/snapshots/05_scopes_and_captures__nested_capture_avoidance.snap index 14c7695..d4c2a6b 100644 --- a/tests/snapshots/05_scopes_and_captures__nested_capture_avoidance.snap +++ b/tests/snapshots/05_scopes_and_captures__nested_capture_avoidance.snap @@ -12,5 +12,5 @@ term eval steps: 2 reduces: 2 - allocs: 7 + allocs: 1 time: [time] diff --git a/tests/snapshots/05_scopes_and_captures__shadowing.snap b/tests/snapshots/05_scopes_and_captures__shadowing.snap index 56c3aa6..6173b5e 100644 --- a/tests/snapshots/05_scopes_and_captures__shadowing.snap +++ b/tests/snapshots/05_scopes_and_captures__shadowing.snap @@ -12,5 +12,5 @@ term eval steps: 2 reduces: 2 - allocs: 1 + allocs: 0 time: [time] diff --git a/tests/snapshots/06_pairs_and_recursion__church_pred_zero.snap b/tests/snapshots/06_pairs_and_recursion__church_pred_zero.snap index 23bb7b5..41e34c3 100644 --- a/tests/snapshots/06_pairs_and_recursion__church_pred_zero.snap +++ b/tests/snapshots/06_pairs_and_recursion__church_pred_zero.snap @@ -12,5 +12,5 @@ term eval steps: 13 reduces: 13 - allocs: 46 + allocs: 2 time: [time] diff --git a/tests/snapshots/06_pairs_and_recursion__church_predecessor.snap b/tests/snapshots/06_pairs_and_recursion__church_predecessor.snap index 1bf01b9..d2ae0be 100644 --- a/tests/snapshots/06_pairs_and_recursion__church_predecessor.snap +++ b/tests/snapshots/06_pairs_and_recursion__church_predecessor.snap @@ -12,5 +12,5 @@ term eval steps: 30 reduces: 30 - allocs: 84 + allocs: 2 time: [time] diff --git a/tests/snapshots/06_pairs_and_recursion__factorial.snap b/tests/snapshots/06_pairs_and_recursion__factorial.snap index 79402fa..d5bb60d 100644 --- a/tests/snapshots/06_pairs_and_recursion__factorial.snap +++ b/tests/snapshots/06_pairs_and_recursion__factorial.snap @@ -12,5 +12,5 @@ term eval steps: 652 reduces: 652 - allocs: 2772 + allocs: 5 time: [time] diff --git a/tests/snapshots/06_pairs_and_recursion__fibonacci.snap b/tests/snapshots/06_pairs_and_recursion__fibonacci.snap index b3d5562..80b9ac3 100644 --- a/tests/snapshots/06_pairs_and_recursion__fibonacci.snap +++ b/tests/snapshots/06_pairs_and_recursion__fibonacci.snap @@ -12,5 +12,5 @@ term eval steps: 237 reduces: 237 - allocs: 595 + allocs: 2 time: [time] diff --git a/tests/snapshots/06_pairs_and_recursion__list_map.snap b/tests/snapshots/06_pairs_and_recursion__list_map.snap index 55e0dc2..4e94ec3 100644 --- a/tests/snapshots/06_pairs_and_recursion__list_map.snap +++ b/tests/snapshots/06_pairs_and_recursion__list_map.snap @@ -12,5 +12,5 @@ term eval steps: 57 reduces: 57 - allocs: 240 + allocs: 6 time: [time] diff --git a/tests/snapshots/06_pairs_and_recursion__pair_first.snap b/tests/snapshots/06_pairs_and_recursion__pair_first.snap index fee8abc..6fccba1 100644 --- a/tests/snapshots/06_pairs_and_recursion__pair_first.snap +++ b/tests/snapshots/06_pairs_and_recursion__pair_first.snap @@ -12,5 +12,5 @@ term eval steps: 8 reduces: 8 - allocs: 13 + allocs: 0 time: [time] diff --git a/tests/snapshots/06_pairs_and_recursion__pair_second.snap b/tests/snapshots/06_pairs_and_recursion__pair_second.snap index 9deb3c8..183da94 100644 --- a/tests/snapshots/06_pairs_and_recursion__pair_second.snap +++ b/tests/snapshots/06_pairs_and_recursion__pair_second.snap @@ -12,5 +12,5 @@ term eval steps: 8 reduces: 8 - allocs: 13 + allocs: 0 time: [time]