schemer n : a planner who draws up a personal scheme of action [syn: plotter]
- Rhymes: -iːmə(r)
he who plots secret, devious plans
- Czech: pletichář
Scheme is a multi-paradigm programming language. It is one of the two main dialects of Lisp and supports a number of programming paradigms but is best known for its support of functional programming. It was developed by Guy L. Steele and Gerald Jay Sussman in the 1970s. Scheme was introduced to the academic world via a series of papers now referred to as Sussman and Steele's Lambda Papers. There are two standards that define the Scheme language: the official IEEE standard, and a de facto standard called the Revisedn Report on the Algorithmic Language Scheme, nearly always abbreviated RnRS, where n is the number of the revision. The most widely implemented standard is R5RS, and on August 28, 2007, R6RS, the next major revision of the Scheme language was ratified, with about 2/3rd of the voters in favor of R6RS.
Scheme's philosophy is minimalist. Scheme provides as few primitive notions as possible and, where practical, lets everything else be provided by programming libraries.
Scheme was the first dialect of Lisp to choose static (a.k.a. lexical) over dynamic variable scope. It was also one of the first programming languages to support first-class continuations.
Scheme started as an attempt to understand Carl Hewitt's Actor model. Scheme was originally called "Schemer", in the tradition of other Lisp-derived languages like Planner or Conniver. The current name resulted from the authors' use of the ITS operating system, which limited filenames to two components of at most six characters each. Currently, "Schemer" is commonly used to refer to a Scheme programmer.
A new language standardization process began at the 2003 Scheme workshop, with the goal of producing an R6RS standard in 2006. This process broke with the earlier RnRS approach of unanimity.
R6RS features a standard module system, allowing a split between the core language and libraries. A number of drafts of the R6RS specification were released, the final version being R5.97RS. A successful vote resulted in the ratification of the new standard, announced on August 28, 2007.
As of December 2007 two Scheme implementations, Larceny and a newcomer known as Ikarus, support substantial subsets of the R6RS standard.
On March 7, 2008 it was announced, that PLT Scheme 4.0 will support R6RS programs and libraries.
R6RS introduces numerous significant changes to the language, which include the following:
- The source code is now specified in Unicode, and a large subset of unicode characters may now appear in Scheme symbols and identifiers, and there are other minor changes to the lexical rules.
- Two new styles for comments have been added.
- Character data is now specified in Unicode.
- Many standard procedures have been moved to the new standard libraries, which themselves form a large expansion of the standard, containing procedures and syntactic forms that were formerly not part of the standard. Supporting the libraries and the production of further libraries.
- The new standard introduces a module system.
- An exception system is now specified.
- Compliant implementations are now required to support Scheme's full numeric tower, and the semantics of numbers have been expanded, mainly in the direction of support for the IEEE 754 standard for floating point numerical representation.
Like all Lisp dialects, Scheme has a very simple syntax. There are no operator precedence rules because fully nested and parenthesized notation is used for all compound forms. Example (the recursive factorial function):
(define (fact n) (if (= n 0) 1 (* n (fact (- n 1)))))
Scheme is a minimalist language. The R5RS language standard Recently SRFI-40, the streams SRFI for Scheme, was withdrawn by its author, Philip L. Bewig, as a result of discussion that unveiled a serious space leak in the specification. The revised version, SRFI-41, is currently in draft status.
Scheme's high level macro system allows the user to add new syntactic constructs to the language. It respects the lexical scoping of the rest of the language, which avoids common programming errors that can occur in the macro systems of other programming languages. Many implementations also provide a more conventional low level macro system.
Tail recursiondetails tail recursion
Even though looping constructs (such as the do form) are provided in Scheme, and one can use macros to easily define iterating control structures, Scheme programs often use tail recursion to express loops, much more commonly than in many other languages. This is in part due to the fact that Scheme implementations are required to optimize tail calls so as to eliminate use of stack space where possible, so that arbitrarily long loops are guaranteed to run in constant space. These two comment forms are included in the newly ratified R6RS.
Variables are dynamically typed. Variables are bound by a define, a let expression, and a few other Scheme forms. Variables bound at the top level with a define are in global scope.
(define var1 value)
A define expression is equivalent to a let expression whose body is the rest of the current scope.
Variables bound in a let are in scope for the body of the let.
(let ((var1 value)) ... ; scope of var1 ...)
let is a convenient syntax that is not fundamentally necessary. A let expression can be implemented using procedures directly. For example, the above is equivalent to:
((lambda (var1) ... ; scope of var1 ...) value)
1 (define fun (lambda (arg1 arg2) ...)) 2 (define (fun arg1 arg2) ...) 3 (fun value1 value2) 4 (apply fun (list value1 value2))
Functions (often called procedures) are first-class objects in Scheme. They can be arguments to other functions and be returned by them. They can be assigned to variables. Functions are created by lambda forms. For example a function with two arguments arg1 and arg2 is defined in line 1; line 2 is a shorter, equivalent form. line 3 shows how functions are applied. Note that the function being applied is in the first position of the list while the rest of the list contains the arguments. The apply function will take its first argument and apply it to a given list of arguments, so the previous function call can also be written as seen in line 4.
In Scheme, functions are divided into two basic categories: procedures and primitives. All primitives are procedures, but not all procedures are primitives. Primitives are pre-defined functions in the Scheme language. These include +, -, *, /, set!, car, cdr, and other basic procedures. Procedures are user-defined functions. In several variations of Scheme, a user can redefine a primitive. For example, the code
(define (+ x y) (- x y))
(define + -)
actually redefines the + primitive to perform subtraction, rather than addition.
Listsdetails linked list
Scheme uses the singly-linked list data structure, implemented using a primitive data type called the pair, with accessors: getters car and cdr and setters set-car! and set-cdr!. list-ref provides access to an arbitrary member of a list, length gives its length, and the list constructor is list. There are also procedures to reverse a list, to obtain the tail of a list, to check for list membership, and to perform key-value lookups (association lists).
Besides procedures, continuations, pairs and lists, Scheme provides the following data types: atomic symbols, numbers, booleans, characters, strings, vectors and input/output ports. Extensions are standardized through a system of "Scheme Requests for Implementation" (SRFIs).
Since the IEEE Scheme standard and the R4RS Scheme standard, Scheme has asserted that all of the above types are disjoint, that is no value can belong to more than one of these types; however some very old implementations of Scheme may predate these standards such that #f and '() refer to the same value, as is the case in traditional Lisp including Common Lisp. All currently active implementations use the R4RS interpretation.
The numeric type is further divided into a numerical tower, with subtypes complex, real, rational and integer. (Note that these subtypes are not disjoint; in fact each type is a subset of the last). While it is not required that a Scheme implementation support the entire numerical tower, most implementations do. In addition to these traditional properties, Scheme numbers may have the property of "exactness". Integers and rational numbers are exact. An arithmetic operation involving numbers one or more of which is inexact has an inexact result. of schools; in particular, a number of introductory Computer Science courses use Scheme in conjunction with the textbook Structure and Interpretation of Computer Programs. For the past 12 years, PLT has run the TeachScheme! project, which has exposed close to 600 high school teachers and thousands of high school students to rudimentary Scheme programming. MIT's old introductory programming class 6.001 was taught in scheme, but that class has been replaced with 6.01, which is taught in Python. The introductory class at UC Berkeley, CS 61A, is taught entirely in Scheme; all course materials, including lecture webcasts, are available online free of charge .
There are relatively few examples of Scheme in apparent usage for non-pedagogical purposes. However, the Document Style Semantics and Specification Language (DSSSL), which provides a method of specifying SGML stylesheets, uses a Scheme subset. In addition, the well-known open source raster graphics editor, the GIMP uses Scheme as a scripting language. Guile has been adopted by GNU project as its official scripting language, and that implementation of Scheme is embedded in such applications as GNU LilyPond and GnuCash as a scripting language for extensions. Chez Scheme has been used at Disney World in Florida for controlling virtual rides (Kent Dybvig, invited talk at International Conference on Functional Programming, 2006).
- Structure and Interpretation of Computer Programs, a classic computer science textbook.
- How to Design Programs, which intends to teach principles that go beyond Scheme and to address perceived incongruities in SICP.
- Call-with-current-continuation (call/cc)
- SXML - an illustrative representation for XML in Scheme that provides a straightforward approach to XML data processing in Scheme
- Gerald Sussman and Guy Steele. SCHEME: An Interpreter for Extended Lambda Calculus AI Memo 349, MIT Artificial Intelligence Laboratory, Cambridge, Massachusetts, December 1975.
schemer in Bengali: স্কিম (প্রোগ্রামিং ভাষা)
schemer in Bulgarian: Scheme
schemer in Catalan: Scheme
schemer in Czech: Scheme
schemer in Danish: Scheme
schemer in German: Scheme
schemer in Spanish: Scheme
schemer in Esperanto: Scheme
schemer in Persian: اسکیم
schemer in French: Scheme
schemer in Korean: 스킴 (프로그래밍 언어)
schemer in Croatian: Scheme (programski jezik)
schemer in Italian: Scheme
schemer in Hebrew: Scheme
schemer in Lithuanian: Scheme
schemer in Hungarian: Scheme
schemer in Dutch: Scheme
schemer in Japanese: Scheme
schemer in Norwegian: Scheme
schemer in Polish: Scheme
schemer in Portuguese: Scheme
schemer in Russian: Scheme
schemer in Slovak: Scheme (programovací jazyk)
schemer in Slovenian: Scheme (programski jezik)
schemer in Finnish: Scheme
schemer in Swedish: Scheme
schemer in Vietnamese: Scheme
schemer in Turkish: Scheme
schemer in Ukrainian: Scheme
schemer in Samogitian: Scheme
schemer in Chinese: Scheme
Benedict Arnold, Brutus, Judas, Judas Iscariot, Machiavellian, Quisling, archtraitor, betrayer, calculator, cockatrice, coconspirator, conniver, conspirator, conspirer, counterplotter, double agent, double-crosser, double-dealer, exploiter, finagler, informer, intrigant, intriguer, machinator, maneuverer, manipulator, operator, opportunist, plotter, quisling, rat, serpent, snake, strategist, tactician, timeserver, traitor, treasonist, trimmer, turncoat, wire-puller