This article will demonstrate basic arithmetic operations -- comparison, addition, subtraction, multiplication, and division -- on non-negative and negative integer numbers. Both the integers and the operations on them are represented as terms in the pure untyped lambda-calculus. The only building blocks are identifiers, abstractions and applications. No constants or delta-rules are used. Reductions follow only the familiar beta-substitution and eta-rules.
Implementing substraction in the LC can be a bit challenging. Natrually, the problem is related to the method used to represent numbers as lambda-calculus terms. This rather subtle issue is explored, and demonstrated.
Posted to LC by Ehud Lamm on 6/5/01; 4:06:24 AM
|
|