Scheme (programming language)

This is an old revision of this page, as edited by 81.77.112.7 (talk) at 11:45, 8 April 2003 (Random tweaking). 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 Jay 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.'

Scheme's philosophy is unashamedly minimalist. Its goal is not to pile feature upon feature, but to remove weaknesses and restrictions that make new features appear necessary. Therefore, Scheme provides as few primitive notions as possible, and let everything else be implemented on top of them. For example, the main mechanism for governing control flow is tail recursion.

Scheme was the first variety of Lisp to use lexical variable scoping (as opposed to dynamic variable scoping) exclusively. Like Lisp, Scheme supports garbage collection of unreferenced data. It uses lists as the primary data structure, but also has good support for arrays. Owing to the minimalism of the specification, there is no standard syntax for creating structures with named fields, or for doing object oriented progamming, but many individual implementations have such features.

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 there are essentially no operators -- as in Lisp, prefix notation is used for all function calls.

Thanks to its macro facilities, Scheme can be adapted to any problem ___domain. They can even be used to add support for object-oriented programming. Scheme provides a hygenic macro system, which while not quite as powerful as Common Lisp's macros, is much safer and often easier to work with.

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 also supports variable assignment and 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. Functions can also be created anonymously.


Disadvantages of Scheme

Unlike scripting languages such 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
  • Chicken is a Scheme-to-C compiler. It can be found here.
  • Guile is the GNU project's official extension language. The Scheme interpreter is packaged as a library to provide 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 Component object model and ODBC libraries.
  • Gauche is an R5RS Scheme implementation developed to be a handy script interpreter, which allows programmers and system administrators to write small to large scripts for their daily chores. Quick startup, built-in system interface, native multilingual support are some of my goals. Gauche is being developed by Shiro Kawai and BSD licensed.It can be found at this site.
  • Bigloo is a Scheme-to-C and Scheme-to-Java compiler which produces small, fast executables. It focuses on being a practical tool for real-world tasks, and there is a relatively large number of useful libraries available for it.


Additional Resources