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 (