Scheme Programming/Using a Scheme interpreter

From Wikibooks, open books for an open world
Jump to: navigation, search
Scheme Programming
 ← What defines Scheme? Using a Scheme interpreter A taste of Scheme → 

On most Unix machines, 'scm' can be installed. This is a Scheme interpreter which adheres to R5RS very well.

To invoke the interpreter, simply type 'scm' at the command line. It is common to write your programs into a text file using Vim or emacs, and then load them in using the 'load command':

$ scm
> (load "myFile.scm")

Windows users have a number of options for getting a standards-conforming Scheme implementation. Both PLT Scheme/Racket and MIT/GNU Scheme will work. (However, keep in mind that Racket implements its own version of the language, with considerable changes in syntax).

There are a great many Scheme systems available for use, and, unfortunately, they can all behave quite differently. Portability for Scheme programs written using nonstandard features are rare, so often the correctness of one's code will vary depending on the compiler or interpreter used. For this reason, when maximum portability is desired, it is wise to write all code in R5RS, as this is the most widely implemented standard. (R6RS has elicited controversy from some).