Specified in 1958, Lisp is one of the oldest programming languages, and it does not appear to be widely used anymore. But if you want to play around with the 61 years old language, you may want to do so in a neat way via the Visible Lisp Computer, a Lisp interpreter that displays the contents of the Lisp workspace on an OLED display.
It is a modified version of Technoblogy’s uLisp interpreter for Arm boards designed to run on Adafruit ItsyBitsy M0, or other boards based on Microchip ATSAMD21E MCU on a prototyping board, connected to a 64×48 OLED display over I2C.
uLisp gives you a workspace of 3072 free Lisp objects (each of 8 bytes) on this hardware, which exactly matches the 3072 pixels (64×48) from the display. Having said that the program would also work on larger SSD1306-based OLED displays.
The display shows free Lisp objects in black, and when an object is in use the corresponding pixel turns white, and from time to time, you’ll see garbage collection in action, reclaiming used objects that can no longer be accessed.
The hardware wiring diagram is pretty basic, and you just need to extra 4.7 kOhm resistance for the I2C signals (SDA, SCL). Then you can connect the board to your computer over USB, and access the serial terminal.
When the board first run the display is fully black. If you enter a Fibonacci function such as:
(defun fib (n)
(if (< n 3) 1
(+ (fib (- n 1)) (fib (- n 2)))))
A row of white pixels starting in the top left corner is displayed to represent a series of Lisp objects.
Then you can run the function with (fib 10) or (fib 16), or whatever number that’s small enough to fit into memory, and you’ll see the display fills itself, until it’s full, and you can start seeing garbage collections triggered as shown in the first photo above. This behavior and the program is explained in more details on Technoblogy’s post about the project.
If you’d like to try it our yourself, you’ll need to purchase Adafruit ItsyBitsy M0 board on Adafruit or Pimoroni for about $12, as well as the OLED display which can be found on Aliexpress for around $2.
Thanks to Ennio for the tip.