And lambda is working nicely too, once I added support for val to the function call evaluaator (just looking it up in comb_to_mark_map)

This commit is contained in:
Nathan Braswell
2021-08-24 00:33:29 -04:00
parent 634812cea4
commit 649e0107d4
2 changed files with 27 additions and 5 deletions

View File

@@ -114,6 +114,8 @@
_ (println (indent_str indent) "Going to do an array call!")
_ (println (indent_str indent) " total is " x)
_ (println (indent_str indent) " evaled comb is " comb)
comb (if (val? comb) (get-value comb_to_mark_map (.val comb))
comb)
)
; it seems like even if it's later we should be able to eval some?
; Maybe there should be something between 'later and 'comb made in vau
@@ -175,7 +177,7 @@
[comb_to_mark_map ['later (cons actual_function literal_params)]])
[comb_to_mark_map func_result])
) result)
true (error (str "Partial eval noticed that you will likely call not a function " x))))
true (error (str "Partial eval noticed that you will likely call not a function " comb " total is " x))))
(nil? x) [comb_to_mark_map ['val x]]
true (error (str "impossible partial_eval value " x))
)

View File

@@ -56,7 +56,25 @@
let2_test (read-string "((wrap (vau (let1) (let1 a 12 (vau (x) (+ a 1))))) (vau de (s v b) (eval (array (array vau (array s) b) (eval v de)) de)))")
let3_test (read-string "((wrap (vau (let1) (let1 a 12 (wrap (vau (x) (+ x a 1)))))) (vau de (s v b) (eval (array (array vau (array s) b) (eval v de)) de)))")
let4_test (read-string "((wrap (vau (let1) (let1 a 12 (wrap (vau (x) (let1 y (+ a 1) (+ y x a))))))) (vau de (s v b) (eval (array (array vau (array s) b) (eval v de)) de)))")
;let5_test (read-string "((wrap (vau (let1) (let1 a 12 (wrap (vau (x) (let1 y (+ x a 1) (+ y x a))))))) (vau de (s v b) (eval (array (array vau (array s) b) (eval v de)) de)))")
let5_test (read-string "((wrap (vau (let1) (let1 a 12 (wrap (vau (x) (let1 y (+ x a 1) (+ y x a))))))) (vau de (s v b) (eval (array (array vau (array s) b) (eval v de)) de)))")
lambda1_test (read-string "((wrap (vau (let1)
(let1 lambda (vau se (p b) (wrap (eval (array vau p b) se)))
(lambda (x) x)
))) (vau de (s v b) (eval (array (array vau (array s) b) (eval v de)) de)))")
lambda2_test (read-string "((wrap (vau (let1)
(let1 lambda (vau se (p b) (wrap (eval (array vau p b) se)))
(let1 a 12
(lambda (x) (+ a x)))
))) (vau de (s v b) (eval (array (array vau (array s) b) (eval v de)) de)))")
lambda3_test (read-string "((wrap (vau (let1)
(let1 lambda (vau se (p b) (wrap (eval (array vau p b) se)))
(let1 a 12
(lambda (x) (let1 b (+ a x)
(+ a x b))))
))) (vau de (s v b) (eval (array (array vau (array s) b) (eval v de)) de)))")
;big_test1 [[vau ['*ARGV*] (read-string (slurp "./prelude.kp"))] ["" "-C" "1339"]]
;big_test1 [[vau ['*ARGV*] (read-string (slurp "./prelude.kp"))] ["" "-C" "(let (a 17) (vau (x) a))"]]
@@ -70,8 +88,6 @@
_ (test-case vau_with_no_eval_add)
_ (test-case vau_with_wrap_add)
_ (test-case vau_with_add_p)
;; No longer works with our more aggressive partial-evaling of vaus with incomplete environments
;; BUT DOES CUZ I ROLLED THAT BACK
_ (test-case vau_with_add_p_called)
_ (test-case cond_test)
_ (test-case cond_vau_test)
@@ -88,7 +104,11 @@
_ (test-case let2_test)
_ (test-case let3_test)
_ (test-case let4_test)
;_ (test-case let5_test)
_ (test-case let5_test)
_ (test-case lambda1_test)
_ (test-case lambda2_test)
_ (test-case lambda3_test)
;_ (println "THE BIG SHOW")
;_ (println big_test1)