From cb717d9850ce15fba59fec9c8d51539fb8c08cd3 Mon Sep 17 00:00:00 2001 From: Elijah Cohen Date: Tue, 31 Dec 2024 12:29:44 -0600 Subject: [PATCH] reorg plus more composite combinators --- demos.kl | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/demos.kl b/demos.kl index 038dbcf..c03202c 100644 --- a/demos.kl +++ b/demos.kl @@ -14,6 +14,22 @@ (def U (L O)) (def F (E T T E T)) +(def C* (B C)) +(def C** (B C*)) +(def C*** (B C**)) + +(def C*n (Z (B (S (C (eq 0) C)) (B D (C B (C - 1)))))) + +(def C1 (C* (B C))) +(def C2 (C* (B C1))) +(def C3 (C* (B C2))) + +(def Cn (Z (B (S (C (eq 0) C)) (B (B (B C)) (B D (C B (C - 1))))))) + +(def abstract-generator (Z (B (B (B (B (C (C C nil))))) (B (Phi B (B S (B cons))) (B (B W) (B (B B))))))) + +(def abstract-rec (B (B (B (C B cons))) (B (B (B B)) (B (B (B Z)) (C (B B (B B (B B (B S (C (C Phi cdr) car))))) (B (B (C B)) (B (C B (C B cdr)) (B (Phi cons) (C (C Phi car) cdr))))))))) + (def zd-identity I) (def zd-constant K) @@ -55,12 +71,8 @@ (def fibonacci-generator (Z (B (B (C (C C nil))) (B (Phi cons (Phi + car cdr)) (C B (Phi cons (Phi + car cdr) car)))))) -(def abstract-generator (Z (B (B (B (B (C (C C nil))))) (B (Phi B (B S (B cons))) (B (B W) (B (B B))))))) - (def tr-fac (B (S (Phi (eq 0) cdr car)) (C B (Phi cons (Phi * car cdr) (B (C - 1) cdr))))) -(def abstract-rec (B (B (B (C B cons))) (B (B (B B)) (B (B (B Z)) (C (B B (B B (B B (B S (C (C Phi cdr) car))))) (B (B (C B)) (B (C B (C B cdr)) (B (Phi cons) (C (C Phi car) cdr))))))))) - (def append (B (C (abstract-rec not (B (C B car) (C cons)) cdr)) reverse)) (def filter (C (C (B (abstract-rec not) (B W (B (B C) (C (B C (B (B B) (C (B B S) (C cons)))) car)))) cdr) nil)) -- 2.39.2