Bläddra i källkod

context and def! alloc

ada 5 år sedan
förälder
incheckning
7be811d99a
3 ändrade filer med 18 tillägg och 3 borttagningar
  1. 14 1
      lisp/jubjub-mul.lisp
  2. 3 1
      lisp/lisp.rs
  3. 1 1
      lisp/run.sh

+ 14 - 1
lisp/jubjub-mul.lisp

@@ -1,9 +1,21 @@
-(println "jubjub-mul.lisp")
+ (println "jubjub-mul.lisp")
 (def! param4 (scalar "015d8c7f5b43fe33f7891142c001d9251f3abeeb98fad3e87b0dc53c4ebf1891"))
 (def! param3 (scalar "15a36d1f0f390d8852a35a8c1908dd87a361ee3fd48fdf77b9819dc82d90607e"))
 (def! param2 (scalar "015d8c7f5b43fe33f7891142c001d9251f3abeeb98fad3e87b0dc53c4ebf1891"))
 (def! param1 (scalar "15a36d1f0f390d8852a35a8c1908dd87a361ee3fd48fdf77b9819dc82d90607e"))
 
+    (def! double (fn* [val1 val2] (
+            (def! u11 (alloc "u11" (scalar val1)))
+            (def! v11 (alloc "v11" (scalar val2)))
+            (def! U1 (alloc-input "U1" (* u11 v11)))
+            (enforce  
+                (scalar::one u11) 
+                (scalar::one v11)
+                (scalar::one U1)
+            )
+        )
+    ))
+
 (setup
     (prove 
       (
@@ -19,6 +31,7 @@
       C (alloc "C" (* EDWARDS_D (* A B)))
       u3 (alloc-input "u3" (/ (+ A B) (+ scalar::one C)))
       v3 (alloc-input "v3" (/ (- (- U A) B) (- scalar::one C)))
+      v4 (double param1 param1)
       ]
   (
   (enforce  

+ 3 - 1
lisp/lisp.rs

@@ -165,9 +165,11 @@ fn eval(mut ast: MalVal, mut env: Env) -> MalRet {
                 let a0 = &l[0];
                 match a0 {
                     Sym(ref a0sym) if a0sym == "def!" => {
+                        println!("def {:?}", l[1]);
                         env_set(&env, l[1].clone(), eval(l[2].clone(), env.clone())?)
                     }
                     Sym(ref a0sym) if a0sym == "zk*" => {
+                        println!("zk* {:?}", l[1]);
                         let (a1, a2) = (l[1].clone(), l[2].clone());
                         match a1 {
                             List(ref binds, _) | Vector(ref binds, _) => {
@@ -490,8 +492,8 @@ fn eval(mut ast: MalVal, mut env: Env) -> MalRet {
                                     continue 'tco;
                                 }
                                 _ => {
+                                    println!("{:?}", args);
                                     Ok(vector![el.to_vec()])
-
                                     //error("call non-function")
                                 }
                             }

+ 1 - 1
lisp/run.sh

@@ -1,3 +1,3 @@
-export RUST_BACKTRACE=full
+#export RUST_BACKTRACE=full
 cargo run --bin lisp load jubjub-mul.lisp
 #cargo run --bin lisp load new-cs.lisp