This implementation uses PHP closures to express TRUE, FALSE, NOT,
AND, OR, ZERO, SUCC, PRED, and ONE directly as curried callable
values. Native booleans and integers appear only in the output observers and
self-checks.
- PHP 8.0 or newer
- No Composer packages or other external dependencies
PHP is included in GitHub's current
ubuntu-latest runner image,
so this folder does not require a workflow installation step.
From this directory, run:
sh test.shThe repository-level run-tests.sh runs the same script and compares its
standard output with expected-output.txt.
PHP arrow functions are closure objects and automatically capture values from
their enclosing scope. That permits a close transcription of the curried
lambda terms; for example, TRUE is fn($x) => fn($_y) => $x, and SUCC
applies a supplied function once more than its input numeral does.
Only churchToBool and churchToInt cross into native PHP values. See the
official PHP documentation for
anonymous functions
and arrow functions.