Skip to content

Commit e667621

Browse files
committed
+odd and even checks
1 parent 33fdbe3 commit e667621

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lambdas.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@
8787
(lambda _: ADD(f(DEC(n)))(f(DEC(DEC(n)))))
8888
(ZERO)
8989
)
90+
91+
# more arithmetic
9092
DIV = Y(
9193
lambda f: lambda a: lambda b: LT(a)(b)
9294
(lambda _: ZERO)
@@ -99,6 +101,8 @@
99101
(lambda _: f(SUB(a)(b))(b))
100102
(ZERO)
101103
)
104+
EVEN = lambda a: ISZERO(MOD(a)(TWO))
105+
ODD = lambda a: NOT(EVEN(a))
102106

103107

104108
# helpers

0 commit comments

Comments
 (0)