Teeny Scheme
By Artyom Bologov
1000 commits and 1.5 months ago I set out to make my own Scheme. And now this Teeny (~6KLoC) thing (as of Hairspray Queen release) is mature enough for me to get tearful seeing the filiation. I am truly happy I worked on this project for so long and I want to keep it up. But that happiness is not how the story started.
AI Irritation #
There are two main driving forces for me when I pick my tech:
- I want it to be small, simple, and maintainable.
- And I utterly despise any trace of AI in things I use, because it tends to highlight deeper organizational problems in the project. A lot has been written on the topic. For the rest of the post I’m implying you know the debate and share my AI-cautious position.
It’s only natural that at some point in my life I’d gravitate towards Scheme. It’s small, it’s modern, and it is culturally sane. A perfect community to be in. (I mean, gender balance and overall demographics of the community raise some concerns. But it otherwise is full of nice and knowledgeable people.)
One problem though: all the smaller Schemes I know of and catalogue on the Lisp Against the (LL)Machine list… have succumbed to Generative AI. There’s literally no small non-toy Scheme that is AI-free. This irks me immensely.
Filled with irritation, I decided that fixing this problem is simple: just start my own Scheme!
TinySCHEME #
Shopping around for smaller Schemes, I found TinySCHEME. TinySCHEME is probably the most balanced of smaller Schemes, implementing most of R5RS in mere 6K lines of code. It also had a relatively simple structure I could iterate on. So let this post be a small tribute to TinySCHEME!
There were some problems though:
- The code is quite dated, being written in C89 with weird style conventions.
- Development has effectively stopped, and the only active fork is the one locked to GIMP. It has a really low priority and velocity, while also preserving ugly code conventions.
- Developers are not interested in complying to neither R5RS nor R7RS, while I am.
- The name sucks.
So yeah, I took TinySCHEME code and shaped it to my aesthetic preferences while ensuring it is still a teeny tiny scheme. Resulting in Teeny Scheme, an almost R(5|7)RS-compliant small embeddable Scheme written in modern C!
Modern C #
A frequent reaction to the TinySCHEME code I inherited was… facepalming. Restricting themselves to C89, the developers locked themselves out of the second most exciting version of C ever. (C23 being the most exciting, in my opinion.) Better math, better types, better memory semantics. C99 is simply too good to ignore it.
I’ve already written on my C style.
With iso646.h macros, width-specific numbers, booleans, etc.
I have documented all the style choices in Teeny Scheme CONTRIBUTING.md.
Go read it along with Teeny sources and get amazed at how readable C can be!
While you do so, I’ll go steal some code.
Too Easy #
So, inheriting a robust codebase, using modern C, and appropriating others’ code… I am making things easy for myself. So easy in fact that I am not sure why anyone would use AI to develop their Scheme. Just use what’s already out there lol.
I’d totally recommend making your own Scheme. If only to understand your aesthetic preferences and start appreciating Scheme community and their work. And of course, I’ll be glad to see you engage with Teeny too! Love ya 💜