Skip to content

Commit

Permalink
refactor: remove legacy Lurk reduction (#883)
Browse files Browse the repository at this point in the history
* fix: coproc imports

* refactor: remove Lurk Evaluator

* refactor: remove Alpha reduction

* drop DumbCoproc

---------

Co-authored-by: Arthur Paulino <arthurleonardo.ap@gmail.com>
  • Loading branch information
huitseeker and arthurpaulino authored Nov 14, 2023
1 parent 5c022b1 commit 9b4af90
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 5,197 deletions.
67 changes: 1 addition & 66 deletions lurk-macros/tests/lurk_macro_test.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
#[cfg(test)]
mod test {
use lurk_crate::{
eval::lang::{Coproc, Lang},
eval::{empty_sym_env, Evaluator, IO},
store::Store,
};
use lurk_crate::store::Store;
use lurk_macros::{let_store, lurk};
use pasta_curves::pallas::Scalar as Fr;

type TestLang = Lang<Fr, Coproc<Fr>>;

#[test]
fn test_let_store() {
let_store!();
Expand Down Expand Up @@ -50,63 +44,4 @@ mod test {

assert_eq!(res2, res);
}

#[test]
fn outer_evaluate_recursion1() {
// This test is an example of simple usage. Compare to the commented-out original source for this test.

// let mut s = Store::<Fr>::default();
let_store!();
let limit = 200;

let expr = lurk!((letrec ((exp (lambda (base)
(lambda (exponent)
(if (= 0 exponent)
1
(* base ((exp base) (- exponent 1))))))))
((exp 5) 3)))
.unwrap();

let lang: TestLang = Lang::new();

let (
IO {
expr: result_expr,
env: _new_env,
cont: _continuation,
},
iterations,
_emitted,
) = Evaluator::new(expr, empty_sym_env(s_), s_, limit, &lang)
.eval()
.unwrap();

assert_eq!(91, iterations);
assert_eq!(s_.num(125), result_expr);
}

#[test]
fn outer_evaluate_lambda() {
let_store!();

let limit = 20;
let val = s_.num(123);
let expr = lurk!(((lambda (x) x) 123)).unwrap();
let lang: TestLang = Lang::new();

let (
IO {
expr: result_expr,
env: _new_env,
cont: _continuation,
},
iterations,
_emitted,
) = Evaluator::new(expr, empty_sym_env(s_), s_, limit, &lang)
.eval()
.unwrap();

assert_eq!(4, iterations);
assert_eq!(val, result_expr);
}
}
Loading

1 comment on commit 9b4af90

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmarks

Table of Contents

Overview

This benchmark report shows the Fibonacci GPU benchmark.
NVIDIA GeForce RTX 4070
AMD Ryzen 9 3950X 16-Core Processor
125.711 GB RAM

Benchmark Results

LEM Fibonacci Prove - rc = 100

fib-ref=5c022b137fec92a23f85166dc6d9dd956583e741 fib-ref=9b4af90afaf33add650e052fb9a0047faa90fba8
num-100 3.99 s (✅ 1.00x) 4.00 s (✅ 1.00x slower)
num-200 8.92 s (✅ 1.00x) 8.83 s (✅ 1.01x faster)

LEM Fibonacci Prove - rc = 600

fib-ref=5c022b137fec92a23f85166dc6d9dd956583e741 fib-ref=9b4af90afaf33add650e052fb9a0047faa90fba8
num-100 3.06 s (✅ 1.00x) 3.05 s (✅ 1.00x faster)
num-200 6.99 s (✅ 1.00x) 7.03 s (✅ 1.01x slower)

Made with criterion-table

Please sign in to comment.