diff --git a/lambda-like-macroish.slimp b/lambda-like-macroish.slimp new file mode 100644 index 0000000..def23df --- /dev/null +++ b/lambda-like-macroish.slimp @@ -0,0 +1,27 @@ +(forall (car' cdr) (car (cons car' cdr)) car') +(forall (car cdr') (cdr (cons car cdr')) cdr') + +(forall (a as bs) (++ (cons a as) bs) (cons a (++ as bs))) +(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)) + +; 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)))) + +(lambda-like' -> (a b c) d)