An implementation of Conway's Game of Life written in JavaScript using λ-calculus rules only.

tokarskiy e66fc0d864 Update 'README.md' 4 months ago
src 7913f6557f Initial commit 4 months ago
tests 7913f6557f Initial commit 4 months ago
LICENSE 7913f6557f Initial commit 4 months ago
README.md e66fc0d864 Update 'README.md' 4 months ago
deno.json 7913f6557f Initial commit 4 months ago
deno.lock 7913f6557f Initial commit 4 months ago

README.md

λ-calculus implementations of Conway's Game of Life

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:

  1. Function parameter or alias to previously defined terms:

    x
    
  2. Creating alias for term:

    const x = $TERM$;
    
  3. 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).

  4. 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, ifs, whiles, 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