Skip to content

Latest commit

 

History

History

php

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

PHP Lambda Core

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.

Requirements

  • 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.

Run and verify

From this directory, run:

sh test.sh

The repository-level run-tests.sh runs the same script and compares its standard output with expected-output.txt.

How the representation works

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.