From: Elijah Cohen Date: Tue, 31 Dec 2024 18:29:44 +0000 (-0600) Subject: reorg plus more composite combinators X-Git-Tag: v-12.13.13~2 X-Git-Url: https://git.eli173.com/?a=commitdiff_plain;h=cb717d9850ce15fba59fec9c8d51539fb8c08cd3;p=klapaucius reorg plus more composite combinators --- 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))