Structure and interpretation of computer programs

Scheme Interpreter

Scheme Interpreter
Scheme Interpreter

Interpreter Features

Read-Eval-Print. The interpreter reads Scheme expressions, evaluates them, and displays the results.

scm> 2
2
scm> (+ 2 3)
5
scm> (((lambda (f) (lambda (x) (f f x)))
       (lambda (f k) (if (zero? k) 1 (* k (f f (- k 1)))))) 5)
120



Load. The load procedure differs from standard Scheme in that it uses a symbol for the file name. For example, to load tests.scm, evaluate the following call expression.

scm> (load 'tests)



Symbols. Rule for identifiers:

An identifier is a sequence of letters (a-z and A-Z), digits, and characters in !$%&*/:<=>?@^_~-+. that do not form a valid integer or floating-point numeral.

The version of Scheme used is case-insensitive: two identifiers are considered identical if they match except possibly in the capitalization of letters. They are internally represented and printed in lower case:

scm> 'Hello
hello