From f7ac85519ffa02b3de1ec39ddb430c35f56dbbd4 Mon Sep 17 00:00:00 2001 From: ada Date: Thu, 29 Oct 2020 15:33:50 +0100 Subject: [PATCH] changed from eval to eval_ast for zconst --- lisp/core.rs | 6 ++++++ lisp/new.lisp | 1 + 2 files changed, 7 insertions(+) diff --git a/lisp/core.rs b/lisp/core.rs index e8456df41..8e3a192cd 100644 --- a/lisp/core.rs +++ b/lisp/core.rs @@ -252,6 +252,11 @@ fn conj(a: MalArgs) -> MalRet { } } +fn sub(a: MalArgs) -> MalRet { + // get next symbol should be lc0 lc1 lc2 + Ok(Sub(Rc::new(a[0].clone()), Rc::new(a[1].clone()))) +} + fn add(a: MalArgs) -> MalRet { // get next symbol should be lc0 lc1 lc2 Ok(Add(Rc::new(a[0].clone()), Rc::new(a[1].clone()))) @@ -358,6 +363,7 @@ pub fn ns() -> Vec<(&'static str, MalVal)> { ("swap!", func(|a| a[0].swap_bang(&a[1..].to_vec()))), ("unpack-bits", func(unpack_bits)), ("add", func(add)), + ("sub", func(sub)), ("lc0", func(|a| Ok(MalVal::Lc0))), ] } diff --git a/lisp/new.lisp b/lisp/new.lisp index 6e59cc051..caa0981d8 100644 --- a/lisp/new.lisp +++ b/lisp/new.lisp @@ -5,6 +5,7 @@ ;;zkcons add a constraints instruction to the circuit (zkcons! circuit ( (add lc0 one) + (sub lc0 x) ) ) ;; (map (fn* [b] (zkcons! circuit (