Jump to content

Scheme (programming language)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ap (talk | contribs) at 23:45, 1 September 2002. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The Scheme programming language is a functional programming language which is a dialect of Lisp. It was developed by Guy L. Steele and Gerald J. Sussman in the 1970s and introduced to the academic world via a series of papers now referred to as Sussman and Steele's 'Lambda Papers.'

It was the first variety of Lisp to feature lexical variable scoping rather than dynamic variable scoping. Like Lisp, Scheme supports garbage collection of unreferenced data. It uses lists as primary data structure, and list operations such as cdr and car.

Scheme's philosophy is unashamedly minimalist: provide as few primitive notions as possible, and let everything else be implemented on top of them. For instance, the main mechanism for governing control flow is tail recursion.

Why the curious name? Well, it was originally called "Schemer", in the tradition of the languages Planner and Conniver, but its authors used the ITS operating system which didn't allow filenames longer than 6 characters.

Advantages of Scheme

Scheme has very little syntax compared to many other programming languages. It has no operator precedence rules because they are explicit in the notation.

Thanks to its macro facilities, Scheme can be adopted to any problem domain. Extending Scheme to naturally support object-oriented programming can only be done with macros.

Scheme encourages functional programming. Pure functional programs need no global variables and don't have side-effects, and are therefore automatically thread-safe, automatically verifyable and have more of these nice properties. However, Scheme can also do variable assignment for those who want it.

In Scheme, functions are first class citizens. This means they can be passed as arguments to another function or stored in a variable and manipulated. This allows higher order functions that can further abstract program logic.

Disadvantages of Scheme

Unlike scripting languages as Perl or Python, Scheme is not standardized beyond its core. Functions that exist in one Scheme implementation do not need to exist in another or may have a completely different name and/or interface. The Scheme Requests for Implementation (SRFI) process tries to remedy this.

Standards

There are two standards that define the Scheme language: the official IEEE standard, and a de facto standard called the Revisedn-th Report on the Algorithmic Language Scheme, nearly always abbreviated RnRS, where n is the number of the revision. The latest RnRS version is R5RS, available online at http://www.schemers.org/Documents/Standards/R5RS/ .

Examples

Scheme code can be found in at least the following Wikipedia articles:

Implementations

  • Chez Scheme, a proprietary freeware Scheme interpreter and commercial Scheme compiler for Microsoft Windows and several UNIX systems
  • Guile is the GNU project's official extension language. The Scheme interpreter is packaged as a library to provides scripting to applications. It can be found here.
  • The PLT Scheme suite, a suite of Scheme programs for Windows, Mac, and Unix platforms including an interpreter (MzScheme), a graphical toolkit (MrEd), a pedagogically-oriented graphical editor (DrScheme), and various other components including COM and ODBC libraries.

Additional Resources