Binary Lambda Calculus implemented as a shell on top of λDNA

Darius J Chuck

2024-01-18

This is just a short note about something cool I made with the previously announced λDNA programming language.

I meant to write a proper blog post about this some time ago, but in case that doesn’t materialize, I am reposting a lightly edited Discord message.


Here is something pretty cool:

A Hello World generated by a Brainfuck program running on a Brainfuck interpreter running on the BLC8 universal machine running on BLC8 (all this wizarded up by John Tromp) implemented as a shell on top of λDNA, all written in pure JS and (hopefully :D) running in your browser:

https://xtao.org/ldna/blc8.html#urls[[uni.Blc][bf.Blc][hw.bf]]

And here it is running John’s Hilbert curve drawing program:

https://xtao.org/ldna/blc8.html#urls[[hilbert.Blc]]texts[[aaaa][]]

All this is to say that I played around with the thing further and managed to throw together implementations of BLC and BLC8 as “shells” on top of λDNA to demonstrate the idea.

Online versions of the shells for BLC and BLC8 are here:

I mirrored some of the BLC programs from Justine Tunney’s SectorLambda post here:

They can be loaded into the shells either by clicking the buttons marked ‘load program’ at the top or by drag&dropping a program link onto the page.

I also added a crude mechanism for sharing which should help with collaborative debugging, etc. All input you enter is serialized into a URL at the top of the page which you can copy-paste to share your session. The URL is automatically wrapped in <>, so it will display correctly on Discord.

Seems like all programs work – although beware primes.blc which generates an infinite sequence of primes. This will eventually hang/crash the browser tab as memory fills up.

Implementing all this I found that my original input idea was a bit too simplistic, so I had to adjust it slightly to restore referential transparency. Now that the whole thing can run the BF interpreter and the universal machines, I am more confident that it works in the general case and it is possible to implement different I/O protocols/shells on top of λDNA.

It’s all very rough and the code is a mess at the moment, but it’ll have to do for now. It is published here: https://codeberg.org/xtao-org/ldna/

Anyway, I hope you folks find this as fun and interesting as I did. Let me know if you find any bugs, run into any problems or have any questions.

PS Here is a song to listen to when playing around with this:

Support TAO

If you like, you can support my work with a small donation.

Donate directly via Stripe   or   Buy Me a Coffee at ko-fi.com   Postaw mi kawę na buycoffee.to

Thank you!

Darius J Chuck