I belive I fixed the bug revealed by the let definition - it was a similar thing where <comb>s were counted as values even if there were fake envs inside, and then thouse fake envs could be moved inside another env_stack and then later resolve to a wrong env, or at lest I think that's what was happening. The let test takes too long to run now - I killed it at 20 minutes and 48GB of RAM taken. Given that, it's now time to move on towards optimization

This commit is contained in:
Nathan Braswell
2022-01-07 22:08:29 -05:00
parent b559bfdf90
commit 6ef60c4cc6
2 changed files with 48 additions and 27 deletions

View File

@@ -8,27 +8,32 @@
(let1 current-env (vau de () de)
(let1 cons (lambda (h t) (concat (array h) t))
(let1 lapply (lambda (f p) (eval (cons (unwrap f) p) (current-env)))
;(let1 vapply (lambda (f p ede) (eval (cons f p) ede))
(let1 vapply (lambda (f p ede) (eval (cons f p) ede))
(let1 Y (lambda (f)
((lambda (x) (x x))
(lambda (x) (f (lambda (& y) (lapply (x x) y))))))
((lambda (x1) (x1 x1))
(lambda (x2) (f (lambda (& y) (lapply (x2 x2) y))))))
(let1 vY (lambda (f)
((lambda (x3) (x3 x3))
(lambda (x4) (f (vau de (& y) (vapply (x4 x4) y de))))))
;(let1 let (vY (lambda (recurse) (vau de (vs b) (cond (= (len vs) 0) (eval b de)
; true (vapply let1 (array (idx vs 0) (idx vs 1) (array recurse (slice vs 2 -1) b)) de)))))
(array 'open 3 "test_self_out" (lambda (fd code)
(array 'write fd "waab" (lambda (written code)
(array 'write fd "wabcde" (lambda (written code)
(array 'exit written)))))
; end of all lets
)
;)
))))
))))))
; impl of let1
; this would be the macro style version (((;)) (vau de (s v b) (eval (array (array wrap (array vau (array s) b)) v) de)))
)) (vau de (s v b) (eval (array (array vau (array s) b) (eval v de)) de)))
; impl of quote
)) (vau (x) x))
)) (vau (x5) x5))