I made my own Scheme, and it was a joy! assets/teeny.png A digitally drawn person, handing you the heart with “scm” written in it. There are rays around them and their lower body is covered by a cloud. I have no idea what that art means. IMAGE-ALT

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:

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:

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.

Code Sharing and Sample Implementation Culture

At the moment of writing, Teeny supports (via teenylib) 27 SRFIs and all the R7RS Small libraries except (scheme complex). All of these supported in under a month essentially. All thanks to a strong code sharing culture in Scheme community. People implementing Schemes tend to write their code in a portable and unopinionated way. Most exemplary in the sample implementations of SRFIs. Many SRFI authors test and run their SRFIs on 5+ implementations. While maintaining code simplicity and readability. A small wonder it is.

Alex Shinn is particularly good at this. I am routinely looking through Chibi Scheme sources and libs. And always find something to creatively appropriate. Despite routinely using LLMs, Alex is important to Teeny Scheme. I’m glad there’s a person whose work I can use so easily and rely on it being reasonable in all aspects.

I am a stupid person. And I realize my cognitive limitations. So whenever I can rely on someone else doing a better job than me—I do. And I’m grateful to the people I take code and ideas from. Thanks!

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 💜