Church numerals in lambda calculus are a representation of the natural numbers using only functions. More specifically, the nth natural number is repr

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-11-30 07:30:03

Church numerals in lambda calculus are a representation of the natural numbers using only functions. More specifically, the nth natural number is represented as an n-fold application of a function f to an argument x. For example, the 4th Church numeral is equal to:

Using only C++11 templates, it's possible to construct and use Church numerals! Interestingly, all numeric operations are implemented without using explicit recursion - this is accomplished by taking advantage of the properties of Church numerals.

All implementation details can be found in include/temple. Tests are in the tests directory. Temple itself has no external dependencies; however, some tests use the metal metaprogramming library.

Leave a Comment