An implementation of Conway's Game of Life written in JavaScript using λ-calculus rules only.
tokarskiy e66fc0d864 Update 'README.md' | 4 months ago | |
---|---|---|
src | 4 months ago | |
tests | 4 months ago | |
LICENSE | 4 months ago | |
README.md | 4 months ago | |
deno.json | 4 months ago | |
deno.lock | 4 months ago |
An implementation of Conway's Game of Life written in JavaScript using λ-calculus. The full implementation contains in lambda-calculus.js file.
Rules being used for building terms:
Function parameter or alias to previously defined terms:
x
Creating alias for term:
const x = $TERM$;
Lambda abstraction:
Lambda is a function taking one argument and returning some value.
There's two ways to define an lambda abstraction:
(x) => $TERM$
or
(x) => {
const y = $TERM_Y$;
return $RETURN_TERM$;
}
Every lambda function should contain only one return statement (inner functions do not count).
A function application:
fun(arg)
It is forbidden to use recursion:
const fun = (x) => {
return fun(x); /* FORBIDDEN */
};
These rules mean, that it's forbidden to use any libraries (even stdlib),
primitives, classes, if
s, while
s, lambdas with 0, 2 or more arguments,
lambdas returning void
, arrays and other things. The only building block
is lambda function, taking 1 argument and returning value.
Rules above may be ignored only in modules, responsible for unit testing or interaction with "outer world" (console.log). These modules are defined in files lambda-calculus.test.ts, lambda-calculus.frontend.ts, conway-game-of-life.frontend.ts.
This app is created for educational purposes. The performance of this app is extremely low, this is not a way how read-world apps are being written.
Run the app using command:
deno task game-of-life