Lambda Calculus - Foundation of Functional Programming
summary
JavaScript implementations show lambda calculus constructs: Church numerals implemented as n-fold function application, Church booleans with select-first/select-second functions, successor as one-more application, predecessor via the pair-iteration trick discovered historically while waiting for dental work, and arithmetic built from these. Recursion uses the Z combinator (eager form of Y), enabling factorial and integer division (truncating remainder). Complexity reaches up to O(n^4) for exponentiation-based designs. All code runs from a GitHub repo and tests complete in about 18 ms on Bun/M1.
AI-written summary · about
