Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 531 Bytes

README.md

File metadata and controls

27 lines (20 loc) · 531 Bytes

ChurchEncodings

Church Encoding is a means of modeling data and operators using lambda abstractions in Lambda Calculus.

Implementated in Python

Illustration

Code

# Representing true as a function
TRUE = lambda x: lambda y: x

# Representing false as a function
FALSE = lambda x: lambda y: y

# Representing ! (Not) operator as a function
NOT = lambda b: b(FALSE)(TRUE)

print(NOT(TRUE))
print(NOT(FALSE))

Output

<function FALSE at 0x1040bce18>
<function TRUE at 0x10432d0d0>