Y combinator works, as well as vY (the vau version, which is different b/c applicative order), and prototype for new load style removing set works

This commit is contained in:
Nathan Braswell
2020-09-16 00:07:49 -04:00
parent 23910ba51e
commit 62e991d0dd
3 changed files with 73 additions and 7 deletions

View File

@@ -70,3 +70,13 @@
(add_grammar_rule 'form '("~" optional_WS form) (lambda (_ _ f) ['unquote f]))
(add_grammar_rule 'form '("," optional_WS form) (lambda (_ _ f) ['splice-unquote f]))
(set! Y (lambda (f)
((lambda (x) (x x))
(lambda (x) (f (lambda (& y) (lapply (x x) y)))))))
(set! vY (lambda (f)
((lambda (x) (x x))
(lambda (x) (f (vau de (& y) (vapply (x x) y de)))))))
(set! rep (Y (lambda (recurse) (wrap (vau de ()
(do (println (eval (read-string (get_line "> ")) de)) (recurse)))))))