An interactive, browser-based tutorial teaching lambda calculus from basics to advanced topics using vanilla JavaScript ES6 modules.
docs/
├── index.html # Landing page
├── chapters/ # Tutorial chapters
│ ├── 01-combinators.html
│ ├── 02-church-encodings.html
│ ├── 03-numerals.html
│ ├── 04-data-structures.html
│ ├── 05-recursion.html
│ └── 06-advanced.html
├── lib/ # Lambda calculus implementations (ES6 modules)
│ ├── combinators.js
│ ├── lamb.js
│ ├── utils.js
│ ├── data.js
│ ├── factorial.js
│ └── fibonacci.js
├── js/ # Interactive framework
│ ├── interactive.js
│ └── visualizer.js
└── css/ # Styling
├── main.css
└── code-theme.css
Since this tutorial uses ES6 modules, you need to run a local HTTP server (browsers block ES6 module imports from file:// URLs).
cd docs
python3 -m http.server 8000cd docs
npx servecd docs
php -S localhost:8000Then open http://localhost:8000 in your browser.
Open test.html in your browser (via the local server) to verify all modules load correctly:
http://localhost:8000/test.html
This tutorial is designed to be deployed to GitHub Pages:
-
Enable GitHub Pages in your repository settings
- Go to Settings → Pages
- Source: Deploy from a branch
- Branch:
master(ormain) - Folder:
/docs - Click Save
-
Wait for deployment (usually 1-2 minutes)
- Check the Actions tab for deployment status
-
Access your site
- URL:
https://<username>.github.io/<repo-name>/
- URL:
Requires a modern browser with ES6 module support:
- Chrome 61+
- Firefox 60+
- Safari 11+
- Edge 16+
- Interactive Demos: Live code examples that run in the browser
- Interactive Widgets: User input forms to experiment with lambda calculus
- Visual Reductions: Step-by-step evaluation visualizations
- Church Numeral Visualizers: See numbers as repeated function application
- List Structure Diagrams: Visual representation of nested pairs
- Safe Error Handling: Graceful handling of stack overflow with educational messages
The tutorial follows a progressive structure:
- Chapter 1: Foundation with combinators (Id, K, M)
- Chapter 2: Booleans and logic as choice functions
- Chapter 3: Numbers as repeated application
- Chapter 4: Data structures (lists, pairs)
- Chapter 5: Recursion with thunking pattern
- Chapter 6: Advanced topics and connections to FP
- No build step: Pure HTML/CSS/JS
- No frameworks: Vanilla JavaScript for clarity
- ES6 Modules: Native browser module support
- Zero dependencies: Self-contained tutorial
- Responsive: Mobile-friendly design
The tutorial demonstrates pure lambda calculus concepts but is constrained by JavaScript's runtime:
- Stack depth: Recursion limited to ~10-15 levels
- No tail call optimization: Most JS engines don't optimize tail recursion
- Strict evaluation: JavaScript is eager, not lazy (worked around with thunks)
These limitations are clearly explained in the tutorial with educational context.
To add new chapters or features:
- Create HTML in
chapters/ - Add any new lambda calculus functions to
lib/ - Create chapter-specific demos in the HTML file
- Use the
InteractiveDemoclass fromjs/interactive.js - Test locally before pushing
This educational content is designed to teach lambda calculus concepts through interactive examples.