Lambda PHP alternatives and similar libraries
Based on the "Miscellaneous" category.
Alternatively, view Lambda PHP alternatives based on common mentions on social networks and blogs.
-
Country List
:globe_with_meridians: List of all countries with names and ISO 3166-1 codes in all languages and data formats. -
Essence
Extracts information about web pages, like youtube videos, twitter statuses or blog articles. -
sabre/vobject
:date: The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects -
Lodash-PHP
Easy to use utility functions for everyday PHP projects. This is a port of the Lodash JS library to PHP -
Embera
A Oembed consumer library, that gives you information about urls. It helps you replace urls to youtube or vimeo for example, with their html embed code. It has advanced features like offline support, responsive embeds and caching support. -
ClassPreloader
Optimizes class loading performance by generating a single PHP file containing all of the autoloaded files. -
Metrics
Simple library that abstracts different metrics collectors. I find this necessary to have a consistent and simple metrics (functional) API that doesn't cause vendor lock-in. -
Cake Utility
[READ-ONLY] CakePHP Utility classes such as Inflector, Text, Hash, Security and Xml. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp -
RedisSessionHandler
An alternative Redis session handler for PHP featuring per-session locking and session fixation protection -
Yell
PHP package to make your objects strict and throw exception when you try to access or set some undefined property in your objects.
Cloudways' Black Friday Offer - 1st Choice of Developers
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Lambda PHP or a related project?
README
lambda-php
[reduce forever](doc/reduce-forever.png)
Lambda calculus interpreter in PHP.
Lambda calculus
Lambda calculus is a very minimal programming language that was invented in 1936 by Alonzo Church. It is the functional equivalent of the Turing Machine.
Lambda calculus has only three concepts: Function definitions, lexically scoped variables, function application.
An example term would be the identity function:
位x.x
The first part 位x
defines a function that takes an x
, the .
signifies
that the part that follows is the function body. The body just returns x
.
In PHP, you would write the same thing as follows:
function ($x) {
return $x;
}
You can nest function definitions. Here is a function returning a function:
位x.位y.x
And you can also apply a function to an argument, which just means calling the function.
位f.位g.f g
Which is the short hand (left-associative) form of writing
位f.位g.(f g)
Nested calls like:
位f.位g.位h.f g h
Are interpreted as:
位f.位g.位h.((f g) h)
If you want to change the grouping to be right-associative, you need to explicitly group them in parentheses:
位f.位g.位h.(f (g h))
Interestingly, lambda calculus is turing complete. Using just these three concepts you can represent any computation.
Check out the links at the bottom for more details on how to do stuff in lambda calculus.
Interpreter
This project consists of a lambda calculus expression parser using dissect, and an eval-apply interpreter based on Matt Might's implementation in scheme.
The interpreter is call-by-value which means that recursive calls need to be wrapped in a function to prevent them from being evaluated eagerly.
For examples of how to do numbers (church encoding), booleans, arithmetic,
boolean logic, looping (recursion), etc. look at example.php
.
REPL
This project ships with a read-eval-print-loop that you can use to evaluate lambda calculus expressions:
$ php repl.php
By default, it is in int-mode, expecting the result of the expression to be a church-encoded number. Example:
$ php repl.php
i> 位f.位x.f (f (f x))
3
You can switch to bool-mode by sending the b
command:
$ php repl.php
i> b
b> 位x.位y.x
true
Or r
for raw mode:
$ php repl.php
i> r
r> 位x.x
位x.x
WIP
A few things are still a work in progress:
Krivine machine: This alternate interpreter would allow call-by-need and indexing into de-bruijn indices, which is needed by...
Binary lambda calculus: Allows encoding lambda calculus programs in binary form which produces extremely small programs. This also defines an I/O mechanism.
References
- Matt Might: 7 lines of code, 3 minutes
- Tom Stuart: Programming with Nothing
- Jean-Louis Krivine: A call-by-name lambda-calculus machine
- R茅mi Douence, Pascal Fradet: The Next 700 Krivine Machines
- Xavier Leroy: The Zinc Experiment
- John Tromp: Binary Lambda Calculus and Combinatory Logic
- John Tromp: Binary Lambda Calculus interpreter for IOCCC
- Erkki Lindpere: Parsing Lambda Calculus in Scala
- Binary Lambda Calculus in Python
- Krivine Machine in Scheme
- Algorithmic Information Theory in Haskell
- Lambda Calculus - Wikipedia
- Binary Lambda Calculus - Wikipedia
- De Bruijn index - Wikipedia