fix macroish example

oof. shadowing
This commit is contained in:
mehbark 2023-06-15 14:23:33 -04:00
parent 1cc38adba9
commit a4012b8a72

View file

@ -5,23 +5,27 @@
(forall (bs) (++ () bs) bs)
(forall (f acc) (foldr f acc ()) acc)
(forall (f acc x xs) (foldr f acc (cons x xs)) (foldr f (app f acc x) xs))
(forall (f acc x xs) (foldr f acc (cons x xs)) (foldr f (app f acc x) xs))
(forall (x xs) (snoc x xs) (++ xs (cons x ())))
(def (reverse ()) ())
(forall (x xs) (reverse (cons x xs)) (snoc x (reverse xs)))
; could be sugared much better
; also this is just map? ugh this is just map
; defeats the whoel point KLFJkljfksdljf 1:24 brain
(forall (var body) (for var () body) ())
(forall (var x xs body) (for var (cons x xs) body) (cons (let var x body) (for var xs body)))
(forall (bindings body) (@ bindings body) (lambda-like lambda bindings body))
(forall (var body arg) ((lambda var body) arg) (let var arg body))
(forall (lam bindings body)
(lambda-like' lam bindings body)
(unquote
(foldr
(@ (acc binding)
(quote (lam binding acc)))
body
(quote bindings))))
(unquote
(foldr
(@ (acc' x')
(quote (lam x' acc'))
)
body
(reverse (quote bindings))
)
)
)
(lambda-like' -> (a b c) d)