Defining Integers

The integers (and other constants) can be defined in the λ-calculus; it is not necessary to provide them as "built in". However this "implementation" of integers is not efficient and so they invariably are built into programming languages based on the λ-calculus. Here is a λ-calculus definition of non-negative integers and some operators on them:




Here, integers are PRINTed in unary notation. (Well, you try defining a binary or decimal print routine this way – exercise!-)

There are more λ-calculus examples here.