The Joy of Scheming
A few mornings ago I hacked together a basic Scheme system in JavaScript. I needed an interpreter for another project I was working on and Scheme fit the bill: simple to parse, simple to evaluate, yet incredibly expressive.
There’s a magical quality to writing compilers and interpreters. Early in the process, programs in the target language just act and behave like strings. But there’s this turning point where these programs start computing things. I’ve written lots of typecheckers and fragments of language-related programs recently, but it had been some time since I’d built a system that worked end-to-end like this one. As a result, I’d forgotten the feeling of enchantment and pure joy of seeing programs come alive in this way.
My first taste of Scheme had been in the fall of 2016. I remember searching the internet for “best books to learn about recursion” or something to that effect. Two books were consistently recommended: The Little Schemer and SICP. I bought a heavily-used copy of The Little LISPer (the first edition of TLS) and was instantly hooked. For the next several weeks, I thought about Scheme and recursion incessantly. My notes for other classes were covered in s-expressions, and anyone who saw them must’ve thought I’d lost my grip.
A few chapters into The Little LISPer I started working through SICP. I was working at the front desk at our school’s gym, a job which consisted mostly of standing in one place in front of a computer. So in the evenings, once the flow of patrons slowed down to a trickle, I’d open a browser tab and pick up wherever I’d left off. I’d think about symbolic differentiation or continuations while switching the towels from the washer to the dryer, or wiping down equipment.
There’s a quality to The Little Schemer, SICP, and Scheme itself that’s hard to pin down. Reading either of these books feels a bit like walking into a humble little country restaurant, a couple of chefs in the back chopping squash and onions they just pulled from the garden. How good could it possibly be? you wonder, given the simple ingredients and unimposing look of the place. But the first bite dispels all doubt: under skillful hands, a few humble vegetables have been transformed into the most delicious thing you’ve tasted in years. What’s more, after you’ve eaten, they invite you to the kitchen, hand you an apron, and show you all they know.