#use wml::tmpl::main title="Scheme -- consistent, elegant, concise, and easy to learn" PAGE=programming SUBPAGE=scheme
<H1>Scheme</H1>

<P>
<A href="http://www.swiss.ai.mit.edu/projects/scheme/">Scheme</A> started as
an experiment in programming language design by challenging some fundamental
design assumptions. It emerged from
<A href="http://www.mit.edu/">MIT</A>
in the mid-1970's. It is a dialect of
Lisp invented by Guy Lewis Steele Jr. and
<A href="http://www.swiss.ai.mit.edu/~gjs/gjs.html">Gerald Jay Sussman</A>.
Originally
called Schemer, it was shortened to Scheme because of a 6 character
limitation on file names. Scheme is a small, exceptionally clean
language which is fun to use. The language was designed to have very
few, regular constucts which compose well to support a variety of
programming styles including functional, object-oriented, and
imperative.
Scheme was influenced by lambda calculus, which is one of the first functional
``programming languages'' in the world, Algol, from which Scheme
inherited statical scope and Lisp, from which Scheme inherited the
syntax.

<H2>Features</H2>
<P>
Scheme is a statically (= lexically) scoped and <foldoc weakly typed>
programming language which is very well suited for transformational
programming (that is, it is easy to write programs that write
programs), scripting and for developing and implementing programming
languages--among other things. Most of the Scheme implementations are
interactive (that is, <foldoc interpreters>), but there are also compilers
available.

<P>
The procedures in Scheme are first class procedures, which means that
they can be given as arguments to other procedures, they can be
returned as the value of a procedure, they can be bound to variables
or fields of other objects etc. The arguments of Scheme procedures are
passed by value.

<P>
Syntactically Scheme is very simple and beautiful. The syntax consists
of parentheses and <foldoc prefix notation>, which means that the operator
comes first and then the operands.

<H2>Dialects and standards</H2>
The first description of Scheme was written
by Gerald Jay Sussman and Guy Lewis Steele Jr., "Scheme: an interpreter for extended lambda calculus". MIT Artificial Intelligence Memo 349, December 1975.
A revised report appeared in 1978, which described the evolution of the
language as its MIT implementation was upgraded to support an innovative
compiler (Rabbit). Three distinct projects began in 1981 and 1982 to use
variants of Scheme for courses at MIT, Yale, and Indiana University.

<P>
As Scheme became more widespread, local dialects began to diverge
until students and researchers occasionally found it difficult to
understand code written at other sites. Fifteen representatives of the
major implementations of Scheme therefore met in October 1984 to work
toward a better and more widely accepted standard for Scheme.
<p>
Their report (The revised revised report on Scheme, or an uncommon Lisp [RRRS])
was published at MIT and Indiana University in the
summer of 1985. Further revision took place in the spring of 1986
(<A href="ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/standards/r3rs.ps.gz">The revised^3 report on the
algorithmic language Scheme</A> [R3RS]), and in the spring
of 1988 (<A href="ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/standards/r4rs.ps.gz">The revised^4 report
on the algorithmic language Scheme</A> [R4RS]).
The present report reflects further revisions agreed upon in a meeting at
Xerox PARC in June 1992 (<A href="http://www.swiss.ai.mit.edu/~jaffer/r5rs_toc.html">R5RS</A>).
Have a look at the <A href="http://www.cs.indiana.edu/scheme-repository/doc.standards.html">Scheme Standards documents</A> section of
<A href="http://www.cs.indiana.edu/scheme-repository/home.html">The Internet Scheme Repository</A> for more details.

<H2>Learning (with) Scheme</h2>
<P>
Scheme is a wonderful choice as an introductory language: its clear
syntax makes it possible to concentrate on the programming problems at
hand instead of wasting a lot of time on teaching the syntax. It is
also possible to teach several different programming paradigms, e.g.
functional, imperative and object oriented (message passing). Scheme is also
a very small language and is therefore easy to learn.
Hal Abelson's, Jerry Sussman's and Julie Sussman's
<A href="http://mitpress.mit.edu/sicp/">
Structure and Interpretation of Computer Programs</A>
(<A href="http://mitpress.mit.edu/">MIT Press</A>, 1984; ISBN 0-262-01077-1),
an excellent computer science text used in introductory courses at MIT is
one of the bibles of the LISP/Scheme world. It is a good example of
the usefulness of Scheme in teaching programming concepts. Also called
Wizard Book because of the wizard on the jacket.
Also, less commonly, known as the Purple Book.
<p>
Another online book is <A href="http://www.scheme.com/tspl2d/">The Scheme
Programming Language, 2nd Edition</A>
which is a introduction to Scheme, but not to programming in general.

<P>
<A href="http://www.schemers.org/">Schemer.org</A> is a very comprehensive
web resource for all things Scheme.

<H2>Implementations</H2>
<P>
These days, there is a huge number of Scheme implementations available.
Some people even say there are more implementations than Scheme programmers.

<H3><A name="guile">Guile</A></H3>
<P>
<A href="http://www.gnu.org/software.guile.html">Guile</A> is an interpreter
for Scheme, packaged for use in a wide variety of environments. Guile
implements Scheme as described in 
<A href="http://www.swiss.ai.mit.edu/~jaffer/r5rs_toc.html">R5RS</A>,
providing clean and general data and control structures. Guile goes beyond
the rather austere language presented in R5RS, extending it with
<UL>
<LI>a module system,</LI>
<LI>full access to POSIX system calls,</LI>
<LI>networking support,</LI>
<LI>multiple threads,</LI>
<LI>dynamic linking,</LI>
<LI>a foreign function call interface,</LI>
<LI>powerful string processing,</LI>
<LI>and many other features needed for programming in the real world.</LI>
</UL>
<P>
Guile can run interactively, reading expressions from
the user, evaluating them, and displaying the results, or as a script
interpreter, reading and executing Scheme code from a file. However,
Guile is also packaged as an object library, allowing other
applications to easily incorporate a complete Scheme interpreter. An
application can use Guile as an extension language, a clean and
powerful configuration language, or as multi-purpose "glue",
connecting primitives provided by the application. It is easy to call
Scheme code from C code and vice versa, giving the application
designer full control of how and when to invoke the interpreter.
Applications can add new functions, data types, control structures,
and even syntax to Guile, creating a domain-specific language tailored
to the task at hand, but based on a robust language design.
<P>
Guile's module system allows one to break up a large program into
manageable sections with well-defined interfaces between them. Modules
may contain a mixture of interpreted and compiled code; Guile can use
either static or dynamic linking to incorporate compiled code. Modules
also encourage developers to package up useful collections of routines
for general distribution.
