hn.today

LISPy things you can do in 64K bytes of core

t3x.org58 points12 comments
Screenshot of LISPy things you can do in 64K bytes of core

The discussion asks what kinds of Lisp programs can run when the entire system - including its runtime stack and cons pool - must fit in 64K bytes. It sets that limit against early machines: the MIT IBM 704 had 32K 36-bit words, with Lisp using 12K words and leaving space for just under 20,000 cons cells. Many 704s had far less memory and could not run Lisp. A 1964 PDP-1 implementation could run with 4096 18-bit words; its roughly 2000-word system left room for about 2000 cells. Historical Lisp examples show how programs were expressed and entered on those machines.

The practical focus is Kilo LISP, a portable ANSI C implementation small enough to compile as a tiny-model DOS program within the 64K limit. Its system takes about 13K bytes, leaving room for 8192 cons cells, each five bytes. A short association-list function illustrates the style of code it can support. By comparison, Kilo LISP offers fewer cells than a well-equipped IBM 704 but about four times as many as a minimal PDP-1. Although those original machines were extremely slow by modern standards, execution time is set aside: the central concern is how much Lisp functionality and data fit in a very small memory, with subsequent examples intended to convey the experience of programming under that constraint.

Read on t3x.org12 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.