I Needed 1+1, So I Built a Functional Programming Language

Needed 1+1, built a functional programming language

I Needed 1+1, So I Built a Functional Programming Language

A simple data structures assignment to evaluate 1+1+1 with a binary tree spiraled into building a full functional language in C. The author implemented closures, a garbage collector, a custom arena allocator, a REPL, and an FFI, then watched fib(40) consume 12 GB before crashing. The post details the journey from a tagged union to a chunk allocator and the realization that a garbage collector was inevitable.

Fib(40) literally took 12+ GIGABYTES before hitting an OOM and crashing. Why? Because it spawns approximately 1.3 Billion nodes. At 48 bytes per node, that’s ~62.4 GB worth of node allocations.

More from this day

2026-09-30