Basti's Scratchpad on the Internet
20 Sep 2012

A Story about Schemes

Disclaimer: If you are a programmer, or wanting to be a programmer, or interested in programming, or, well, reading this, you should absolutely, positively watch the 1986 MIT lecture about The Structure and Interpretation of Computer Programs. (Most conveniently available here)

I tried reading the book numerous times, but it was too dry for my taste. The lecture however is juicy, brain-bending bliss. Especially if you don't know much functional programming yet. It certainly blew my mind. Frequently. Like, every ten minutes. Basically, I feel reborn as a programmer, with a new sense of what I am doing and how it should be done.

However, this is not about SICP, it is about Scheme, which happens to be the programming language that SICP uses to preach its sermons. Above all, Scheme beautiful. It is an astounding marriage of simplicity and power. It is also a mess in terms of implementations. There are dozens of implementations and they all implement a different, partly overlapping set of features that may or may not be part of the canonical Scheme–if there is such a thing.

So, how to select the correct Scheme? Naively, I first chose the one SICP uses, MIT-Scheme. However, I soon found out that it does not work well with Emacs (that is, it did not work at all with scheme-mode and run-scheme). Also, its prompt is weird: ]=>. Whatever.

So next, I tried Gambit Scheme, which works a lot better with Emacs. But then, I soon found out that it does not support functions like filter, which are kind of essential. I was quick to write my own version of that, but really, this stuff should be provided. Turns out, filter is part of a Scheme Request For Implementation, or SRFI. filter is part of SRFI1. There is a huge list of different Schemes and the SRFIs they support. Also, there is a list of Schemes sorted by performance. With plots, even. It's a mess.

So this left me profoundly confused. What Scheme would I use? Ideally, it should be fast, work with Emacs and implement a reasonable set of SRFIs. Homebrew lists these:

bigloo chibi-scheme chicken
gambit-scheme gauche guile
kawa mit-scheme plt-racket
scheme48 scsh sisc-scheme
stklos tinyscheme  

Difficult decision. Frankly, I don't have an answer. That said, I found plt-racket to be a joy to work with. (help filter) will open your browser with the appropriate help page for filter. Amazing. Also, it implements a long list of SRFIs that will probably satisfy my simplistic needs. And the documentation is excellent. And then there is DrRacket, which is a nice REPL that comes right with Racket. I like it.

Tags: scheme
Other posts
Creative Commons License by Bastian Bechtold is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.