diff --git a/src/fib.rs b/src/fib.rs index 4003a2d254..bad44e4443 100644 --- a/src/fib.rs +++ b/src/fib.rs @@ -1,7 +1,7 @@ use crate::{ - eval::lang::Coproc, + eval::lang::{Coproc, Lang}, field::LurkField, - lem::{eval::evaluate_simple, pointers::Ptr, store::Store}, + lem::{eval::{compute_frame, eval_step, evaluate_simple}, pointers::Ptr, store::Store}, }; pub fn fib_expr(store: &Store) -> Ptr { @@ -29,6 +29,21 @@ pub fn fib_limit(n: usize, rc: usize) -> usize { rc * (frame / rc + usize::from(frame % rc != 0)) } +pub fn compute_coeff(store: &Store) -> (usize, usize) { + let mut input = vec![fib_expr(store), store.intern_nil(), store.cont_outermost()]; + let lang: Lang> = Lang::new(); + loop { + // TODO + let (frame, _) = + compute_frame(eval_step(), &[], &input, store, &lang, &mut vec![], 0).unwrap(); + + input = frame.output.clone(); + let expr = frame.output[0]; + break; + } + (0, 0) +} + pub fn lurk_fib(store: &Store, n: usize) -> Ptr { let frame_idx = fib_frame(n); let limit = frame_idx; diff --git a/src/lem/eval.rs b/src/lem/eval.rs index 869bee6b4e..1ddcd45663 100644 --- a/src/lem/eval.rs +++ b/src/lem/eval.rs @@ -56,7 +56,7 @@ fn get_pc>( } } -fn compute_frame>( +pub fn compute_frame>( lurk_step: &Func, cprocs_run: &[Func], input: &[Ptr],