Installing Gambit Scheme
As I described in my previous post, I am a fan of the Gambit implementation of Scheme. While following these instructions, try to keep in mind that the Scheme community is smaller than the communities of the more major languages like Python or Ruby, so there are still rough edges that get in the way. I hope that my experiences can speed things up for other fledgling Schemers.
It is possible to install Gambit Scheme from the Ubuntu repositories. However, the repositories contain an older version, so I recommend building Gambit Scheme from source instead. First, go to the Gambit Scheme website.
Click on the “Sources” link and save the gambc-v4_1_0.tgz file to your home directory. Next, open up a terminal (Applications -> Accessories -> Terminal), and enter these commands:
tar -xzvf gambc-v4_1_0.tgz cd gambc-v4_1_0 ./configure && make make check sudo make install sudo make bootstrap cd /usr/bin sudo ln -s /usr/local/Gambit-C/current/bin/gsi gsi cd ~
Once the installation is complete, conduct a few tests. From your terminal, enter the command:
You should then see Gambit’s interactive interpreter prompt. Enter the following code:
(define numlist '(2 10 6)) (map (lambda (x) (* x x)) numlist)
You should receive these results:
Exit the interpreter, by pressing CTRL-D twice. You can also use the Gambit Scheme interpreter to run Scheme programs stored in files. As an example, put the following text into a file named hello.scm:
(display "Hello World!\n")
Run the file with the command:
That should be enough to start experimenting with Scheme. Part 2 will describe the installation and use of the SLIB libraries.