ada 5 лет назад
Родитель
Сommit
e5c260c88b
2 измененных файлов с 5 добавлено и 12 удалено
  1. 4 11
      lisp/lisp.rs
  2. 1 1
      lisp/new-cs.lisp

+ 4 - 11
lisp/lisp.rs

@@ -327,7 +327,7 @@ fn eval(mut ast: MalVal, mut env: Env) -> MalRet {
                             new_hm.insert(a1.pr_str(false), result);
                              env_set(
                                 &env,
-                                Sym("Allocations".to_string()),
+                                Sym("AllocationsInput".to_string()),
                                 Hash(Rc::new(new_hm), Rc::new(Nil)),
                             );
                         };
@@ -366,6 +366,7 @@ fn eval(mut ast: MalVal, mut env: Env) -> MalRet {
                             left_eval, right_eval, out_eval
                         );
                         println!("allocations {:?}", get_allocations(&env, "Allocations"));
+                        println!("allocations input {:?}", get_allocations(&env, "AllocationsInput"));
                         Ok(vector![vec![left_eval, right_eval, out_eval]])
                     }
                     _ => match eval_ast(&ast, &env)? {
@@ -410,17 +411,9 @@ pub fn get_allocations(env: &Env, key: &str) -> MalRet {
     match env_find(env, key) {
         Some(e) => match env_get(&e, &Sym(key.to_string())) {
             Ok(f) => Ok(f),
-            _ => env_set(
-                &env,
-                Sym(key.to_string()),
-                Hash(Rc::new(alloc_hm), Rc::new(Nil)),
-            ),
+            _ => Ok(Hash(Rc::new(alloc_hm), Rc::new(Nil))),
         },
-        _ => env_set(
-            &env,
-            Sym("Allocations".to_string()),
-            Hash(Rc::new(alloc_hm), Rc::new(Nil)),
-        ),
+        _ => Ok(Hash(Rc::new(alloc_hm), Rc::new(Nil))),
     }
 }
 

+ 1 - 1
lisp/new-cs.lisp

@@ -3,7 +3,7 @@
       x (alloc "x" aux)
       x2 (alloc "x2" (* aux aux))
       x3 (alloc "x3" (* aux (* aux aux)))
-      input (alloc-input "input variable" aux)]
+      input (alloc-input "input" aux)]
 
  (setup 
    ;; (enforce left right output)