I’ve been reading through the first chapter of The Little Schemer, and following along in Emacs (specifically: spacemacs).
I jotted down a few notes on getting set up to do this.
First off you’ll need to install a Scheme implementation. There’s a few of them out there. This Reddit thread has some useful discussion on the pros and cons of each of them.
As I’m on Linux and using Emacs, I went with Guile.
To install on Linux Mint, you just need:
sudo apt install guile-2.2
At this point, you could simply fire up Guile and work within the REPL there, if you wanted.
I want to write my Scheme in Emacs, and then send it to the REPL from there. The preferred Emacs package for that seems to be geiser. In spacemacs, geiser comes included with the scheme layer, so all you need to do is add that layer into your config and you’ve got geiser (and some other handy scheme bits and pieces).
Once you’re in a scheme file, run M-x run-geiser
, choose guile from the dropdown, and that’ll start up the Guile REPL and allow you to send parts of your file to it for evaluation. C-x C-e
for example will send the sexp before the cursor.