Python 3.11.6 (main, Oct 8 2023, 05:06:43) [GCC 13.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> id >>> >>> id at 0x7604bf75d300> >>> id(2) 2 >>> k(2)(3) 2 >>> >>> repeated(3,lambda x:x+1,5) 8 >>> c(0)(2)(3) 3 >>> c(1)(lambda x: x + 1)(3) 4 >>> cs at 0x7604bf75d3a0> >>> cs(c(2)) .. at 0x7604be0f76a0> >>> >>> toint(c(0)) 0 >>> toint(c(100)) 100 >>> toint(cs(c(2))) 3 >>> toint(css(c(2))) 3 >>> toint(cplus(c(3))(c(5))) 8 >>> toint(cplus(c(3123))(c(32445))) Traceback (most recent call last): File "", line 1, in File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/church.py", line 18, in toint return cn(lambda x:x+1)(0) ^^^^^^^^^^^^^^^^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/church.py", line 20, in cplus = lambda m: lambda n: lambda f: lambda x: m(f)(n(f)(x)) ^^^^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/church.py", line 11, in return lambda f: lambda x: repeated(n, f, x) ^^^^^^^^^^^^^^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/church.py", line 8, in repeated return f(repeated(n - 1, f, x)) ^^^^^^^^^^^^^^^^^^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/church.py", line 8, in repeated return f(repeated(n - 1, f, x)) ^^^^^^^^^^^^^^^^^^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/church.py", line 8, in repeated return f(repeated(n - 1, f, x)) ^^^^^^^^^^^^^^^^^^^^^ [Previous line repeated 993 more times] RecursionError: maximum recursion depth exceeded >>> toint(cplus(c(312))(c(324))) 636 >>> toint(cplusplus(c(312))(c(324))) 636 >>> toint(cmult(c(5))(c(8))) 40 >>> toint(cmultmult(c(5))(c(8))) 40 >>> toint(cexpexp(c(2))(c(5))) 32 >>> toint(cexpexp(c(2))(c(5))) 32 >>> toint(cexpexp(c(2))(c(5))) 32 >>> toint(cexp(c(2))(c(5))) 32 >>> toint(c(5)(c(2))) 32 >>> toint(c(7)(c(2))) 128 >>> toint(cTrue(c(2))(c(3))) 2 >>> toint(cFalse(c(2))(c(3))) 3 >>> tobool(cnot(cTrue)) False >>> tobool(cand(cTrue)(cFalse)) False >>> tobool(cor(cTrue)(cFalse)) True >>> tobool(czero(c0)) True >>> tobool(czero(c(50))) False >>> tobool(czero(c(49))) False >>> tobool(ceven(c0)) True >>> tobool(ceven(c1)) False >>> tobool(ceven(c(2))) True >>> cpair(c(2))(c(3)) .... at 0x7604be108720> >>> tointpair(cpair(c(2))(c(3))) (2, 3) >>> >>> toint(cp(c0)) 0 >>> toint(cp(c1)) 0 >>> toint(cp(c(2))) 1 >>> toint(cp(c(200))) 199 >>> toint(cfact(c(5))) 120 >>> toint(cfact(c(6))) 720 >>> Y at 0x7604be0f7a60> >>> >>> Y(gammafact) .... at 0x7604be10a660> >>> >>> toint(cfactfact(c(0))) at 0x7604be108400> >>> toint(gammafact(id)(c0)) 1 >>> toint(gammafact(gammafact(id))(c0)) 1 >>> toint(gammafact(gammafact(id))(c1)) 1 >>> toint(gammafact(gammafact(id))(c(2))) 0 >>> toint(gammafact(gammafact(gammafact(gammafact(gammafact(id)))))(c(0))) 1 >>> toint(gammafact(gammafact(gammafact(gammafact(gammafact(id)))))(c(1))) 1 >>> toint(gammafact(gammafact(gammafact(gammafact(gammafact(id)))))(c(2))) 2 >>> toint(gammafact(gammafact(gammafact(gammafact(gammafact(id)))))(c(3))) 6 >>> toint(gammafact(gammafact(gammafact(gammafact(gammafact(id)))))(c(4))) 24 >>> toint(gammafact(gammafact(gammafact(gammafact(gammafact(id)))))(c(5))) 0 >>> toint(gammafact(gammafact(gammafact(gammafact(gammafact(gammafact(id))))))(c(5))) 120 >>> Y(id) Traceback (most recent call last): File "", line 1, in File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 72, in Y = lambda f: (lambda x: f(x)(x))(lambda x: f(x)(x)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 72, in Y = lambda f: (lambda x: f(x)(x))(lambda x: f(x)(x)) ^^^^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 72, in Y = lambda f: (lambda x: f(x)(x))(lambda x: f(x)(x)) ^^^^^^^ [Previous line repeated 996 more times] RecursionError: maximum recursion depth exceeded >>> cfactfact .... at 0x7604be109b20> >>> toint(cfactfact(c0)) at 0x7604be108400> [Previous line repeated 994 more times] RecursionError: maximum recursion depth exceeded >>> Y(gammafact) Traceback (most recent call last): File "", line 1, in File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 72, in Y = lambda f: (lambda x: f(x(x)))(lambda x: f(x(x))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 72, in Y = lambda f: (lambda x: f(x(x)))(lambda x: f(x(x))) ^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 72, in Y = lambda f: (lambda x: f(x(x)))(lambda x: f(x(x))) ^^^^ [Previous line repeated 996 more times] RecursionError: maximum recursion depth exceeded >>> 5 / 0 Traceback (most recent call last): File "", line 1, in ZeroDivisionError: division by zero >>> lambda n: 5 / 0 at 0x7604be108180> >>> >>> omega(omega) Traceback (most recent call last): File "", line 1, in File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 74, in omega = lambda x: x(x) ^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 74, in omega = lambda x: x(x) ^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 74, in omega = lambda x: x(x) ^^^^ [Previous line repeated 996 more times] RecursionError: maximum recursion depth exceeded >>> lambda n: omega(omega) at 0x7604be0f7ec0> >>> Z(id) .... at 0x7604be1082c0> >>> Z(id)(c0) Traceback (most recent call last): File "", line 1, in File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 74, in Z = lambda f: (lambda x: f(lambda z: x(x)(z))) \ ^^^^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 75, in (lambda x: f(lambda z: x(x)(z))) ^^^^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 75, in (lambda x: f(lambda z: x(x)(z))) ^^^^^^^ File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 75, in (lambda x: f(lambda z: x(x)(z))) ^^^^^^^ [Previous line repeated 995 more times] RecursionError: maximum recursion depth exceeded >>> Z(gammafact)(c0) Traceback (most recent call last): File "", line 1, in File "/home/trifon/fmisync/Courses/2023_24/LCPT_2023_24/sandbox/numerals.py", line 79, in gammafact = lambda f: lambda n: czero(n)(c1)(cmult(n)(f(cp(n)))) ^^^^^^^^ File "/home/trifon/fmisync/Coursesobject address : 0x7604bf5ee6e0 object refcount : 5 object type : 0x9d94a0 object type name: RecursionError object repr : RecursionError('maximum recursion depth exceeded') lost sys.stderr >>> >>> toint(Z(gammafactZ)(c0)) 1 >>> toint(Z(gammafactZ)(c(5))) 120 >>> toint(Z(gammafactZ)(c(6))) 720