I have been using the print eval loop, but should I be using something else?
-
1If you are familiar with emacs, try geiser, it's wonderful environment where you can evaluate code as you write it; works with guile, chicken, and racket. before I knew geiser, I used to have shell buffer under keystroke (in emacs as well) and just copy-paste pieces of code written in another buffer (I still do it with irb and js). – dercz Jul 18 '16 at 16:58
-
One alternative is to use [DrRacket IDE](http://stackoverflow.com/questions/19546115/which-lang-packet-is-proper-for-sicp-in-dr-racket/19561746#19561746) – Sylwester Jul 22 '16 at 01:13
5 Answers
The REPL is the place to do it, yes.
Most people use something on top of the REPL in the command line, like emacs, for example. I use xscheme
an emacs library. The alternatives are not very good in my opinion, and using command line only is just intolerable.

- 963
- 8
- 24
If you're using Racket, just use DrRacket.
If you're using MIT Scheme, you may wish to use Edwin, a derivative of Emacs bundled with Mit Scheme, the scheme implementation SICP was originally built for. Edwin is an emacs derivative, so if you already know Emacs, you'll get along with Edwin fine. If you don't know emacs, the basics are:
- C-f, C-b, C-n, and C-p for forwards, backwards, up and down, respectively.
- C-Space to start selecting a region (highlight a piece of text to operate on). The region will stay there until you get rid of it with C-Space, or do something with it.
- C-w to cut the region
- C-k to cut the line, from your cursor onwards
- C-y to paste
- C-x C-e to execute the line of code directly behind your cursor in the scratch/repl buffer (the default window)
- C-c C-c to halt execution of something you ran with C-x C-e
- C-x C-c to quit
That should be enough to start using Edwin. It's incredibly nice to be able to just edit your definition of a function, re-evaluate the definition you edited, and have the new version start working in your repl environment on the fly.

- 11
- 1
-
M-o to load buffer, C-x C-s to save buffer, C-c C-s to switch to the REPL [etc.](https://stackoverflow.com/a/65381283/849891) – Will Ness Dec 22 '20 at 11:58
Use Emacs, and use Geiser within that to access both the REPL and to help with scheme file editing. It also makes dealing with various Scheme REPLs such as Chez Scheme, Racket, MIT Scheme, Guile, Chicken, Gambit and Chibi Scheme effortless.

- 12,994
- 16
- 54
- 75
You can write the scripts in GNU Guile Scheme to implement the exercises in SICP. Most of the inbuilt procedures work with no problem and there is no difference in syntax.
In Linux,
Write the scripts using shebang notation at the beginning of the script file
#!/usr/..<address to guile interpreter> \
-e <name of procedure which should run first> -s
!#
An Example
#!/usr/local/bin/guile \
-e main -s
!#
(define main (args)
(display (+ 3 4))
(newline))
Make the file executable using chmod + <filename>
and run it ./<filename>
P.S. Scheme files are saved using .scm file extension.

- 3,076
- 2
- 35
- 64
-
This will throw an error that main is unbound symbol, you need to use `(define (main args)` – jcubic Jul 20 '16 at 16:02
-