4 ms·
> how else would you define multiplication? In Church arithmetic, multiplication is defined as function composition; that is, the dot operator `.` in Haskell-l
by scatters 6y ago
> how else would you define multiplication?
In Church arithmetic, multiplication is defined as function composition; that is, the dot operator `.` in Haskell-like languages. Addition is considerably more complex; it is defined as `lift (.)`. Exponentiation is even simpler; it is function application, so the `id` function - except that we write exponentiation backwards, so actually `flip id`.
- shawnz 6y agoInteresting, what about tetration then?
- scatters 6y agoGood question: you can define m↑↑n as: \m n -> n (exp m) 1' where `exp` is Church exponentiation, `flip id`, and `1'` is the Church numeral for 1, that is, `id`. According to pointfree.io this expands to: flip flip id . flip id . flip id Which isn't particularly illuminating. Pentation isn't much worse, though: flip flip id . flip id . flip flip id . flip id . flip id