next up previous contents index
Next: Lists Up: Introductory Scheme Previous: The Interpreter

Basics

 

Everything in Scheme, both programs and data, is an S-expression . An S-expression may have one of two types, an atom  or a list . Atoms, as the name suggests, are the fundamental objects in Scheme. An atom may be a number, a symbol, or nil  (which is synonymous with the empty list , which we'll talk about in a moment). A fundamental distinction to the Scheme interpreter is whether or not an object should be evaluated. Numbers  always evaluate to themselves, so this distinction is not important for numeric atoms, such as 27 or 3.14159.

However, for symbols and lists, this distinction is very important. A symbol, for instance, may be either a literal (if it should remain unevaluated), or a variable name (if evaluated).

The quote  function controls whether or not an S-expression should be evaluated; for instance, the atom `foo' is a variable named foo, while (quote foo) evaluates to a literal symbol foo. In addition, (quote expression) may be abbreviated ' expression. 

Throughout this manual, we use a double right arrow (` tex2html_wrap_inline972 ') to denote `evaluates to.' For instance, the following relations denote the behavior of the Scheme interpreter for the atoms we have just discussed:

 
		 27 		  tex2html_wrap_inline972  		 27

3.14159 tex2html_wrap_inline972 3.14159

'foo tex2html_wrap_inline972 foo

(quote foo) tex2html_wrap_inline972 foo

foo tex2html_wrap_inline972 error: undefined variable





Steven J. Zeil
Tue Mar 4 14:36:27 EST 1997