Gambit Logo

Making a CS Gambit

I have a small, very adventurous data structures and algorithms class this year with students hungry to try new things. We are using Python as the primary programming language, and Brad Miller and David Ranum’s Problem Solving with Data Structures and Algorithms as our primary text, but earlier in the course we learned enough C to implement linked lists and stacks in that language.

We are currently studying the chapter on recursion, and have now agreed to learn enough Lisp to get a feel for the central role recursive algorithms play in problem solving with that language. As the teacher, my task is to locate (and evaluate and test) both the documentation and development tools we will use for this project.

Given the numerous dialects and implementations of Lisp available, there was a lot from which to choose, so I decided to work backwards from the educational resources we would use to learn the language to a dialect and implementation that would support those resources with as little interference as possible. As always, I required that all software be free software, and that the educational resources be either OER or at least available at no financial cost to my students.

After looking at what is available online, I settled on two resources, Structure and Interpretation of Computer Programs and The Little Schemer.

Note

The latter is not freely available, but I already have a copy in my classroom, so that and the fact that Structure and Interpretation of Computer Programs has a Creative Commons license led me to choose these resources.

Since these resources use the Scheme dialect of Lisp, my next task was to find a Scheme development environment that would work smoothly with these texts.

Quick Gambit Scheme Setup on Ubuntu 17.10

We mostly run Ubuntu OS on our classroom computers, so I was looking for a version of Scheme that I could install directly from the Ubuntu software repositories. Running:

$ apt search scheme

Revealed numerous choices, incuding:

After trying out most of these, I settled on Gambit for the following reasons:

  1. It was dead simple to install ($ sudo apt install gambit).
  2. It supported parentheses matching in the interpreter out of the box (most implementations require some kind of readline configuration).
  3. It supported rational numbers out of the box.
  4. It works both as an interpreter and as a compiler.

To start the gambit interpreter, run $ gsi. The following screenshot shows a session interacting with gambit