NOTICE: Citizendium is still being set up on its newer server, treat as a beta for now; please see here for more.
Citizendium - a community developing a quality comprehensive compendium of knowledge, online and free. Click here to join and contribute—free
CZ thanks our previous donors. Donate here. Treasurer's Financial Report -- Thanks to our content contributors. --

Scheme (programming language)

From Citizendium, the Citizens' Compendium
(Redirected from Scheme programming language)
Jump to: navigation, search
This article is developing and not approved.
Main Article
Talk
Definition [?]
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
 
This editable Main Article is under development and not meant to be cited; by editing it you can help to improve it towards a future approved, citable version. These unapproved articles are subject to a disclaimer.

Scheme is functional programming language developed by Guy L. Steele. Both the language and the RABBIT compiler are described in his master's thesis. Scheme is considered a dialect of LISP, but it differs from other languages of the LISP family (notably Common LISP) in that it is strict, lexically scoped and designed to be small and efficient. Indeed, Scheme is frequently considered an instructional language, or at least a language designed for research rather than application development. In fact, the name Scheme is actually derived from a program named "Schemer" developed at the M.I.T. AI Lab. Another reason for this perception is that Scheme was designed to more faithfully implement Church's lambda calculus than did comparable languages at the time.

Properties of Scheme

Scheme is a functional language

In fact, Scheme is an almost functional language, it does still allow functions to have side-effects, but in practice it is considered to be a functional language. What does this mean? In the simplest sense, it means that programs consist of functions, objects taking zero or more inputs and producing an output according to a well-defined scheme. By contrast, languages like C, Pascal and FORTRAN are said to be procedural languages. But this description can be a bit misleading. Programs written in procedural languages "compute" by carrying out instructions specified by the programmer. By contrast, a functional program does not consist of instructions to do things, but consists of expressions that may be reduced to simpler expressions via application of a few basic rules (te terminology is due to Church)

  • Alpha conversion - consistent renaming of variables
  • Beta reduction - application of functions
  • Eta conversion - converting expressions to functions (lambda abstraction)
  • Delta rules - rules governing application of built-in functions such as addition (delta rules are not part of the lambda calculus)

In practice, though, Scheme does not make use of reductions directly, but instead proceeds by evaluation. This is made possible by other features of Scheme (notably strictness). The equivalence of the approaches is an important result.

Strictness

Scheme is said to be strict because when expressions are evaluated, any parameters (inputs) must be evaluated before the expression itself is evaluated. In this respect Scheme is similar to languages like Standard ML and differs from "lazy" languages like Haskell.

Sample Programs

Hello World

> (define (hello-world)
    (write "Hello, World!")
    (newline))
> (hello-world)
"Hello, World!"